aboutsummaryrefslogtreecommitdiff
path: root/src/hive_array.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-05-21 21:29:17 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-05-21 21:29:17 -0700
commit9f935c4683e30f40e7c85087d42ab44e65b3c907 (patch)
treeacf2fe92da381a14627a89299933240886b60316 /src/hive_array.zig
parent3c57911b593856feac0799bbb28917bb45ed118f (diff)
downloadbun-9f935c4683e30f40e7c85087d42ab44e65b3c907.tar.gz
bun-9f935c4683e30f40e7c85087d42ab44e65b3c907.tar.zst
bun-9f935c4683e30f40e7c85087d42ab44e65b3c907.zip
[internal] Use `HiveArray` instead of bespoke memory allocator in Bun.serve()
No performance or memory usage change Just removing some duplicate code
Diffstat (limited to 'src/hive_array.zig')
-rw-r--r--src/hive_array.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/hive_array.zig b/src/hive_array.zig
index cc032c44f..a29fe6842 100644
--- a/src/hive_array.zig
+++ b/src/hive_array.zig
@@ -34,7 +34,7 @@ pub fn HiveArray(comptime T: type, comptime capacity: u16) type {
self.available.unset(index);
}
- pub fn indexOf(self: *const Self, value: *const T) ?u63 {
+ 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)))
@@ -44,7 +44,7 @@ pub fn HiveArray(comptime T: type, comptime capacity: u16) type {
const index = (@ptrToInt(value) - @ptrToInt(start)) / @sizeOf(T);
assert(index < capacity);
assert(&self.buffer[index] == value);
- return @truncate(u63, index);
+ return @intCast(u32, index);
}
pub fn in(self: *const Self, value: *const T) bool {