aboutsummaryrefslogtreecommitdiff
path: root/lib/std/math.zig
diff options
context:
space:
mode:
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();