| ... | ... | @@ -1267,12 +1267,11 @@ pub fn HashMapUnmanaged( |
| 1267 | 1267 | /// TODO: answer the question in these doc comments, does this |
| 1268 | 1268 | /// increase the unused capacity by one? |
| 1269 | 1269 | pub fn removeByPtr(self: *Self, key_ptr: *K) void { |
| 1270 | | // TODO: replace with pointer subtraction once supported by zig |
| 1271 | 1270 | // if @sizeOf(K) == 0 then there is at most one item in the hash |
| 1272 | 1271 | // map, which is assumed to exist as key_ptr must be valid. This |
| 1273 | 1272 | // item must be at index 0. |
| 1274 | 1273 | const idx = if (@sizeOf(K) > 0) |
| 1275 | | (@intFromPtr(key_ptr) - @intFromPtr(self.keys())) / @sizeOf(K) |
| 1274 | (key_ptr - self.keys()) |
| 1276 | 1275 | else |
| 1277 | 1276 | 0; |
| 1278 | 1277 | |