Do not run asserts for WASI alignment when not targeting WASI

This commit is contained in:
190n 2024-05-11 00:23:07 -07:00 committed by GitHub
parent 6ca4ed5948
commit cc39ce28a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,14 +7,16 @@ const std = @import("std");
const assert = std.debug.assert;
comptime {
assert(@alignOf(i8) == 1);
assert(@alignOf(u8) == 1);
assert(@alignOf(i16) == 2);
assert(@alignOf(u16) == 2);
assert(@alignOf(i32) == 4);
assert(@alignOf(u32) == 4);
// assert(@alignOf(i64) == 8);
// assert(@alignOf(u64) == 8);
if (builtin.os.tag == .wasi) {
assert(@alignOf(i8) == 1);
assert(@alignOf(u8) == 1);
assert(@alignOf(i16) == 2);
assert(@alignOf(u16) == 2);
assert(@alignOf(i32) == 4);
assert(@alignOf(u32) == 4);
assert(@alignOf(i64) == 8);
assert(@alignOf(u64) == 8);
}
}
pub const iovec_t = std.posix.iovec;