aboutsummaryrefslogtreecommitdiff
path: root/std/math/log2.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-05-07 01:04:43 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-05-07 01:04:43 -0400
commit41e1cd185b82a518c58c92544c45f0348c03ef74 (patch)
tree285d0d90e332dae78807c061cc01202b25c94229 /std/math/log2.zig
parent4d6d2f1cd2a46e95b998b6bbc1effc72b2f4923c (diff)
downloadzig-41e1cd185b82a518c58c92544c45f0348c03ef74.tar.gz
zig-41e1cd185b82a518c58c92544c45f0348c03ef74.zip
std.SegmentedList implementation
Diffstat (limited to 'std/math/log2.zig')
-rw-r--r--std/math/log2.zig7
1 files changed, 1 insertions, 6 deletions
diff --git a/std/math/log2.zig b/std/math/log2.zig
index 998d6d6c5e..d5bbe385c2 100644
--- a/std/math/log2.zig
+++ b/std/math/log2.zig
@@ -31,17 +31,12 @@ pub fn log2(x: var) @typeOf(x) {
return result;
},
TypeId.Int => {
- return log2_int(T, x);
+ return math.log2_int(T, x);
},
else => @compileError("log2 not implemented for " ++ @typeName(T)),
}
}
-pub fn log2_int(comptime T: type, x: T) T {
- assert(x != 0);
- return T.bit_count - 1 - T(@clz(x));
-}
-
pub fn log2_32(x_: f32) f32 {
const ivln2hi: f32 = 1.4428710938e+00;
const ivln2lo: f32 = -1.7605285393e-04;