aboutsummaryrefslogtreecommitdiff
path: root/src/string_types.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/string_types.zig')
-rw-r--r--src/string_types.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/string_types.zig b/src/string_types.zig
index 5063eada6..c091e2a86 100644
--- a/src/string_types.zig
+++ b/src/string_types.zig
@@ -40,19 +40,19 @@ pub const PathString = packed struct {
pub inline fn slice(this: anytype) string {
@setRuntimeSafety(false); // "cast causes pointer to be null" is fine here. if it is null, the len will be 0.
- return @intToPtr([*]u8, @intCast(usize, this.ptr))[0..this.len];
+ return @ptrFromInt([*]u8, @intCast(usize, this.ptr))[0..this.len];
}
pub inline fn sliceAssumeZ(this: anytype) stringZ {
@setRuntimeSafety(false); // "cast causes pointer to be null" is fine here. if it is null, the len will be 0.
- return @intToPtr([*:0]u8, @intCast(usize, this.ptr))[0..this.len :0];
+ return @ptrFromInt([*:0]u8, @intCast(usize, this.ptr))[0..this.len :0];
}
pub inline fn init(str: string) @This() {
@setRuntimeSafety(false); // "cast causes pointer to be null" is fine here. if it is null, the len will be 0.
return @This(){
- .ptr = @truncate(PointerIntType, @ptrToInt(str.ptr)),
+ .ptr = @truncate(PointerIntType, @intFromPtr(str.ptr)),
.len = @truncate(PathInt, str.len),
};
}
@@ -78,13 +78,13 @@ pub const HashedString = struct {
len: u32,
hash: u32,
- pub const empty = HashedString{ .ptr = @intToPtr([*]const u8, 0xDEADBEEF), .len = 0, .hash = 0 };
+ pub const empty = HashedString{ .ptr = @ptrFromInt([*]const u8, 0xDEADBEEF), .len = 0, .hash = 0 };
pub fn init(buf: string) HashedString {
return HashedString{
.ptr = buf.ptr,
.len = @truncate(u32, buf.len),
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, buf)),
+ .hash = @truncate(u32, bun.hash(buf)),
};
}
@@ -106,7 +106,7 @@ pub const HashedString = struct {
return ((@max(this.hash, other.hash) > 0 and this.hash == other.hash) or (this.ptr == other.ptr)) and this.len == other.len;
},
else => {
- return @as(usize, this.len) == other.len and @truncate(u32, std.hash.Wyhash.hash(0, other[0..other.len])) == this.hash;
+ return @as(usize, this.len) == other.len and @truncate(u32, bun.hash(other[0..other.len])) == this.hash;
},
}
}