aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-10-08 17:24:39 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-10-08 17:24:39 -0700
commitdbedfa3d06d6148d489e43c3c4405763c1b13097 (patch)
tree91cc2cf4b2da839dbc8832d4c321c1558e8054cf
parente88e9401f17eea5e4581d234968c9c04e980ea8c (diff)
downloadbun-dbedfa3d06d6148d489e43c3c4405763c1b13097.tar.gz
bun-dbedfa3d06d6148d489e43c3c4405763c1b13097.tar.zst
bun-dbedfa3d06d6148d489e43c3c4405763c1b13097.zip
Ensure Ref is always 64 bits
-rw-r--r--src/ast/base.zig7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ast/base.zig b/src/ast/base.zig
index f1877018c..0006b7315 100644
--- a/src/ast/base.zig
+++ b/src/ast/base.zig
@@ -34,10 +34,13 @@ pub const RefHashCtx = struct {
};
pub const Ref = packed struct {
+ const Padding = std.meta.Int(.unsigned, 64 - ((@bitSizeOf(Int) * 2) + 1));
+
source_index: Int = std.math.maxInt(Ref.Int),
inner_index: Int = 0,
is_source_contents_slice: bool = false,
+ _padding: Padding = 0,
// 2 bits of padding for whatever is the parent
pub const Int = u30;
pub const None = Ref{
@@ -93,3 +96,7 @@ pub inline fn debugl(
) void {
// Output.print("{s}\n", .{fmt});
}
+
+comptime {
+ if (@bitSizeOf(Ref) != 64) @compileError("Ref should be 64 bits exactly");
+}