aboutsummaryrefslogtreecommitdiff
path: root/lib/std/math.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-08-08 00:37:22 -0700
committerAndrew Kelley <andrew@ziglang.org>2020-08-08 00:39:46 -0700
commit9f5a7d5922f48170551e7f6938b6de9eadeba0ff (patch)
tree15cf8d5affeec60acbf0abab243e6aee6dc43d16 /lib/std/math.zig
parentcd6cdd0a752ba3e134ba371246cc02b1d7faaa88 (diff)
downloadzig-9f5a7d5922f48170551e7f6938b6de9eadeba0ff.tar.gz
zig-9f5a7d5922f48170551e7f6938b6de9eadeba0ff.zip
utilize math.ceilPowerOfTwo
Diffstat (limited to 'lib/std/math.zig')
-rw-r--r--lib/std/math.zig4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/std/math.zig b/lib/std/math.zig
index 111a618cef..17237ea9f0 100644
--- a/lib/std/math.zig
+++ b/lib/std/math.zig
@@ -837,6 +837,10 @@ pub fn ceilPowerOfTwo(comptime T: type, value: T) (error{Overflow}!T) {
return @intCast(T, x);
}
+pub fn ceilPowerOfTwoAssert(comptime T: type, value: T) T {
+ return ceilPowerOfTwo(T, value) catch unreachable;
+}
+
test "math.ceilPowerOfTwoPromote" {
testCeilPowerOfTwoPromote();
comptime testCeilPowerOfTwoPromote();