mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 05:42:43 +00:00
Bump Zig again (#18948)
This commit is contained in:
@@ -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,
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user