| ... | ... | @@ -15,13 +15,15 @@ fn ShardedTable(comptime Key: type, comptime mask_bit_count: comptime_int, compt |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | fn getShardKey(key: Key) ShardKey { |
| 18 | // https://github.com/ziglang/zig/issues/1544 |
| 18 | 19 | // this special case is needed because you can't u32 >> 32. |
| 19 | 20 | if (ShardKey == u0) return 0; |
| 20 | 21 | |
| 21 | 22 | // this can be u1 >> u0 |
| 22 | 23 | const shard_key = key >> shift_amount; |
| 23 | 24 | |
| 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 |
| 25 | 27 | // u32 >> 30 -> u2 |
| 26 | 28 | return @intCast(ShardKey, shard_key); |
| 27 | 29 | } |