diff options
author | 2023-07-11 19:14:34 -0700 | |
---|---|---|
committer | 2023-07-11 19:14:34 -0700 | |
commit | cbb88672f217a90db1aa1eb29cd92d5d9035b22b (patch) | |
tree | 43a00501f3cde495967e116f0b660777051551f8 /src/hive_array.zig | |
parent | 1f900cff453700b19bca2acadfe26da4468c1282 (diff) | |
parent | 34b0e7a2bbd8bf8097341cdb0075d0908283e834 (diff) | |
download | bun-cbb88672f217a90db1aa1eb29cd92d5d9035b22b.tar.gz bun-cbb88672f217a90db1aa1eb29cd92d5d9035b22b.tar.zst bun-cbb88672f217a90db1aa1eb29cd92d5d9035b22b.zip |
Merge branch 'main' into jarred/esm-conditionsjarred/esm-conditions
Diffstat (limited to 'src/hive_array.zig')
-rw-r--r-- | src/hive_array.zig | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/hive_array.zig b/src/hive_array.zig index a29fe6842..0213156fd 100644 --- a/src/hive_array.zig +++ b/src/hive_array.zig @@ -37,11 +37,11 @@ pub fn HiveArray(comptime T: type, comptime capacity: u16) type { pub fn indexOf(self: *const Self, value: *const T) ?u32 { const start = &self.buffer; const end = @ptrCast([*]const T, start) + capacity; - if (!(@ptrToInt(value) >= @ptrToInt(start) and @ptrToInt(value) < @ptrToInt(end))) + if (!(@intFromPtr(value) >= @intFromPtr(start) and @intFromPtr(value) < @intFromPtr(end))) return null; // aligned to the size of T - const index = (@ptrToInt(value) - @ptrToInt(start)) / @sizeOf(T); + const index = (@intFromPtr(value) - @intFromPtr(start)) / @sizeOf(T); assert(index < capacity); assert(&self.buffer[index] == value); return @intCast(u32, index); @@ -50,7 +50,7 @@ pub fn HiveArray(comptime T: type, comptime capacity: u16) type { pub fn in(self: *const Self, value: *const T) bool { const start = &self.buffer; const end = @ptrCast([*]const T, start) + capacity; - return (@ptrToInt(value) >= @ptrToInt(start) and @ptrToInt(value) < @ptrToInt(end)); + return (@intFromPtr(value) >= @intFromPtr(start) and @intFromPtr(value) < @intFromPtr(end)); } pub fn put(self: *Self, value: *T) bool { |