diff options
author | 2023-06-21 23:38:18 -0700 | |
---|---|---|
committer | 2023-06-21 23:38:18 -0700 | |
commit | 5fa13625a1ca0ea1a3a1c5bb86d0880dcfac349f (patch) | |
tree | 97f669a178e60772038751d690c3e298a63557b2 /src/allocators.zig | |
parent | bfb322d618a3f0e9618d311ae69016fe7a08e771 (diff) | |
download | bun-5fa13625a1ca0ea1a3a1c5bb86d0880dcfac349f.tar.gz bun-5fa13625a1ca0ea1a3a1c5bb86d0880dcfac349f.tar.zst bun-5fa13625a1ca0ea1a3a1c5bb86d0880dcfac349f.zip |
upgrade zig to `v0.11.0-dev.3737+9eb008717` (#3374)
* progress
* finish `@memset/@memcpy` update
* Update build.zig
* change `@enumToInt` to `@intFromEnum` and friends
* update zig versions
* it was 1
* add link to issue
* add `compileError` reminder
* fix merge
* format
* upgrade to llvm 16
* Revert "upgrade to llvm 16"
This reverts commit cc930ceb1c5b4db9614a7638596948f704544ab8.
---------
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to '')
-rw-r--r-- | src/allocators.zig | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/allocators.zig b/src/allocators.zig index 2827214af..1d3b30c0b 100644 --- a/src/allocators.zig +++ b/src/allocators.zig @@ -2,19 +2,18 @@ const std = @import("std"); const FeatureFlags = @import("./feature_flags.zig"); const Environment = @import("./env.zig"); -const Wyhash = std.hash.Wyhash; const FixedBufferAllocator = std.heap.FixedBufferAllocator; const constStrToU8 = @import("root").bun.constStrToU8; const bun = @import("root").bun; pub fn isSliceInBuffer(slice: anytype, buffer: anytype) bool { - return (@ptrToInt(&buffer) <= @ptrToInt(slice.ptr) and (@ptrToInt(slice.ptr) + slice.len) <= (@ptrToInt(buffer) + buffer.len)); + return (@intFromPtr(&buffer) <= @intFromPtr(slice.ptr) and (@intFromPtr(slice.ptr) + slice.len) <= (@intFromPtr(buffer) + buffer.len)); } pub fn sliceRange(slice: []const u8, buffer: []const u8) ?[2]u32 { - return if (@ptrToInt(buffer.ptr) <= @ptrToInt(slice.ptr) and - (@ptrToInt(slice.ptr) + slice.len) <= (@ptrToInt(buffer.ptr) + buffer.len)) + return if (@intFromPtr(buffer.ptr) <= @intFromPtr(slice.ptr) and + (@intFromPtr(slice.ptr) + slice.len) <= (@intFromPtr(buffer.ptr) + buffer.len)) [2]u32{ - @truncate(u32, @ptrToInt(slice.ptr) - @ptrToInt(buffer.ptr)), + @truncate(u32, @intFromPtr(slice.ptr) - @intFromPtr(buffer.ptr)), @truncate(u32, slice.len), } else @@ -53,7 +52,6 @@ pub const Result = struct { return r.index >= count; } }; -const Seed = 999; pub const NotFound = IndexType{ .index = std.math.maxInt(u31), @@ -488,7 +486,7 @@ pub fn BSSMap(comptime ValueType: type, comptime count: anytype, comptime store_ pub fn getOrPut(self: *Self, denormalized_key: []const u8) !Result { const key = if (comptime remove_trailing_slashes) std.mem.trimRight(u8, denormalized_key, "/") else denormalized_key; - const _key = Wyhash.hash(Seed, key); + const _key = bun.hash(key); self.mutex.lock(); defer self.mutex.unlock(); @@ -516,7 +514,7 @@ pub fn BSSMap(comptime ValueType: type, comptime count: anytype, comptime store_ pub fn get(self: *Self, denormalized_key: []const u8) ?*ValueType { const key = if (comptime remove_trailing_slashes) std.mem.trimRight(u8, denormalized_key, "/") else denormalized_key; - const _key = Wyhash.hash(Seed, key); + const _key = bun.hash(key); self.mutex.lock(); defer self.mutex.unlock(); const index = self.index.get(_key) orelse return null; @@ -577,7 +575,7 @@ pub fn BSSMap(comptime ValueType: type, comptime count: anytype, comptime store_ const key = if (comptime remove_trailing_slashes) std.mem.trimRight(u8, denormalized_key, "/") else denormalized_key; - const _key = Wyhash.hash(Seed, key); + const _key = bun.hash(key); _ = self.index.remove(_key); // const index = self.index.get(_key) orelse return; // switch (index) { |