Bump Zig again (#18948)

This commit is contained in:
Jarred Sumner
2025-04-11 19:13:20 -07:00
committed by GitHub
parent c684a0c8ce
commit 879fdd7ef6
36 changed files with 106 additions and 69 deletions

View File

@@ -1,14 +1,18 @@
const std = @import("std");
const bun = @import("root").bun;
const PathIntLen = std.math.IntFittingRange(0, bun.MAX_PATH_BYTES);
const use_small_path_string_ = @bitSizeOf(usize) - @bitSizeOf(PathIntLen) >= 53;
const PathStringBackingIntType = if (use_small_path_string_) u64 else u128;
// macOS sets file path limit to 1024
// Since a pointer on x64 is 64 bits and only 46 bits are used
// We can safely store the entire path slice in a single u64.
pub const PathString = packed struct {
const PathIntLen = std.math.IntFittingRange(0, bun.MAX_PATH_BYTES);
pub const use_small_path_string = @bitSizeOf(usize) - @bitSizeOf(PathIntLen) >= 53;
pub const PathInt = if (use_small_path_string) PathIntLen else usize;
pub const PointerIntType = if (use_small_path_string) u53 else usize;
pub const PathString = packed struct(PathStringBackingIntType) {
pub const PathInt = if (use_small_path_string_) PathIntLen else usize;
pub const PointerIntType = if (use_small_path_string_) u53 else usize;
pub const use_small_path_string = use_small_path_string_;
ptr: PointerIntType = 0,
len: PathInt = 0,

View File

@@ -4,7 +4,7 @@ const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
/// This is a string type that stores up to 15 bytes inline on the stack, and heap allocates if it is longer
pub const SmolStr = packed struct {
pub const SmolStr = packed struct(u128) {
__len: u32,
cap: u32,
__ptr: [*]u8,
@@ -16,7 +16,7 @@ pub const SmolStr = packed struct {
try writer.write(self.slice());
}
pub const Inlined = packed struct {
pub const Inlined = packed struct(u128) {
data: u120,
__len: u7,
_tag: u1,