We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
rehashTrackedInsts
1 parent bd0ace5 commit 135c733Copy full SHA for 135c733
src/InternPool.zig
@@ -314,7 +314,9 @@ pub fn rehashTrackedInsts(
314
315
// We know how big each shard must be, so ensure we have the capacity we need.
316
for (ip.shards) |*shard| {
317
- const want_capacity = std.math.ceilPowerOfTwo(u32, shard.mutate.tracked_inst_map.len * 5 / 3) catch unreachable;
+ const want_capacity = if (shard.mutate.tracked_inst_map.len == 0) 0 else cap: {
318
+ break :cap std.math.ceilPowerOfTwo(u32, shard.mutate.tracked_inst_map.len * 5 / 3) catch unreachable;
319
+ };
320
const have_capacity = shard.shared.tracked_inst_map.header().capacity; // no acquire because we hold the mutex
321
if (have_capacity >= want_capacity) {
322
@memset(shard.shared.tracked_inst_map.entries[0..have_capacity], .{ .value = .none, .hash = undefined });
0 commit comments