Skip to content

Commit e2baa9f

Browse files
data.zig: add compile error if 32-bit build
See comment for details. Signed-off-by: Ivan-Velickovic <i.velickovic@unsw.edu.au>
1 parent 5551155 commit e2baa9f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/data.zig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@ const builtin = @import("builtin");
33
const sdf = @import("sdf.zig");
44
const Allocator = std.mem.Allocator;
55

6+
comptime {
7+
if (@sizeOf(usize) != 8) {
8+
// Why do we only support 64-bit?
9+
// The main problem is this file, where we serialise C structs
10+
// into binary for consumption by runtime programs. The problem
11+
// is that any implicit padding which exists will be different on 64-bit
12+
// vs 32-bit.
13+
// To allow 32-bit builds, this problem should be solved.
14+
@compileError("only 64-bit targets are supported");
15+
}
16+
}
17+
618
const MAGIC_START: [4]u8 = .{ 's', 'D', 'D', 'F' };
719
const LIONS_MAGIC_START: [7]u8 = .{ 'L', 'i', 'o', 'n', 's', 'O', 'S' };
820

0 commit comments

Comments
 (0)