authorgravatar for thejoshwolfe@gmail.comJosh Wolfe <thejoshwolfe@gmail.com> 2018-09-17 21:25:23-04:00
committergravatar for thejoshwolfe@gmail.comJosh Wolfe <thejoshwolfe@gmail.com> 2018-09-17 21:25:37-04:00
log13645585fe2904f38d13df12e571ecac5bf9e8e6
tree915d2dfd34bc3c517b896c41a7940d847219fee4
parent8f0618a5b1a1aa65ed1600b55aca0ab144c68932

link to #1544


1 files changed, 3 insertions(+), 1 deletions(-)

test/cases/bit_shifting.zig+3-1
......@@ -15,13 +15,15 @@ fn ShardedTable(comptime Key: type, comptime mask_bit_count: comptime_int, compt
1515 }
1616
1717 fn getShardKey(key: Key) ShardKey {
18 // https://github.com/ziglang/zig/issues/1544
1819 // this special case is needed because you can't u32 >> 32.
1920 if (ShardKey == u0) return 0;
2021
2122 // this can be u1 >> u0
2223 const shard_key = key >> shift_amount;
2324
24 // TODO: this cast could be implicit if we teach the compiler that
25 // TODO: https://github.com/ziglang/zig/issues/1544
26 // This cast could be implicit if we teach the compiler that
2527 // u32 >> 30 -> u2
2628 return @intCast(ShardKey, shard_key);
2729 }