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/hash_map.zig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'std/hash_map.zig') diff --git a/std/hash_map.zig b/std/hash_map.zig index ab08d44cc0..7336817954 100644 --- a/std/hash_map.zig +++ b/std/hash_map.zig @@ -157,8 +157,7 @@ pub fn HashMap(comptime K: type, comptime V: type, comptime hash: fn (key: K) u3 fn ensureCapacityExact(self: *Self, new_capacity: usize) !void { // capacity must always be a power of two to allow for modulo // optimization in the constrainIndex fn - const is_power_of_two = new_capacity & (new_capacity - 1) == 0; - assert(is_power_of_two); + assert(math.isPowerOfTwo(new_capacity)); if (new_capacity <= self.entries.len) { return; -- cgit v1.2.3