02-integers.ha (1143B)
1 fn dimensions() void = { 2 // Fixed precision 3 assert(size(i8) == 1 && align(i8) == 1 && size(i8) % align(i8) == 0); 4 assert(size(i16) == 2 && align(i16) == 2 && size(i16) % align(i16) == 0); 5 assert(size(i32) == 4 && align(i32) == 4 && size(i32) % align(i32) == 0); 6 assert(size(i64) == 8 && align(i64) == 8 && size(i64) % align(i64) == 0); 7 assert(size(u8) == 1 && align(u8) == 1 && size(u8) % align(u8) == 0); 8 assert(size(u16) == 2 && align(u16) == 2 && size(u16) % align(u16) == 0); 9 assert(size(u32) == 4 && align(u32) == 4 && size(u32) % align(u32) == 0); 10 assert(size(u64) == 8 && align(u64) == 8 && size(u64) % align(u64) == 0); 11 // Implementation-defined (test meets spec limits) 12 assert(size(int) >= 4 && align(int) >= 4 && size(int) % align(int) == 0); 13 assert(size(uint) >= 4 && align(uint) >= 4 && size(uint) % align(uint) == 0); 14 assert(size(size) % align(size) == 0); 15 assert(size(uintptr) % align(uintptr) == 0); 16 // etc 17 assert(size(char) == 1 && align(char) == 1 && size(char) % align(char) == 0); 18 assert(size(rune) == 4 && align(rune) == 4 && size(rune) % align(rune) == 0); 19 }; 20 21 export fn main() void = { 22 dimensions(); 23 };