bloat-buster/tests/c_struct_with_array.bbb

27 lines
379 B
Plaintext

require = fn(ok: u1) void
{
if (!ok)
{
#trap();
}
}
StructWithArray = struct
{
a: u32,
padding: [4]u8,
b: u64,
}
c_struct_with_array = fn [cc(c)] (x: StructWithArray) void
{
require(x.a == 1);
require(x.b == 2);
}
[export] main = fn [cc(c)] () s32
{
c_struct_with_array({ .a = 1, .padding = [0, 0, 0, 0], .b = 2 });
return 0;
}