From 05e92a51aaaacd0bf326e251763ab97da3d0cd18 Mon Sep 17 00:00:00 2001 From: Ryan Liptak Date: Sun, 9 Jun 2019 22:20:17 -0700 Subject: Use std.math.isPowerOfTwo across std lib --- std/segmented_list.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'std/segmented_list.zig') diff --git a/std/segmented_list.zig b/std/segmented_list.zig index b3a7065ad8..dc3358cd85 100644 --- a/std/segmented_list.zig +++ b/std/segmented_list.zig @@ -80,9 +80,9 @@ pub fn SegmentedList(comptime T: type, comptime prealloc_item_count: usize) type const prealloc_exp = blk: { // we don't use the prealloc_exp constant when prealloc_item_count is 0. assert(prealloc_item_count != 0); + assert(std.math.isPowerOfTwo(prealloc_item_count)); const value = std.math.log2_int(usize, prealloc_item_count); - assert((1 << value) == prealloc_item_count); // prealloc_item_count must be a power of 2 break :blk @typeOf(1)(value); }; const ShelfIndex = std.math.Log2Int(usize); -- cgit v1.2.3