// types — integer limits and helpers, the seed module that the // rest of the stdlib depends on. Plan 9-flavoured: the names are // short and the constants are platform-fixed (we are amd64 only). def I8_MAX: i8 = 127; def I16_MAX: i16 = 32767; def I32_MAX: i32 = 2147483647; def I64_MAX: i64 = 9223372036854775807; def I8_MIN: i8 = -128; def I16_MIN: i16 = -32768; def I32_MIN: i32 = -2147483648; def I64_MIN: i64 = -9223372036854775808; def U8_MAX: u8 = 255; def U16_MAX: u16 = 65535; def U32_MAX: u32 = 4294967295; def U64_MAX: u64 = 18446744073709551615; export fn min_i32(a: i32, b: i32) i32 = { if (a < b) { return a; }; return b; }; export fn max_i32(a: i32, b: i32) i32 = { if (a > b) { return a; }; return b; }; export fn min_i64(a: i64, b: i64) i64 = { if (a < b) { return a; }; return b; }; export fn max_i64(a: i64, b: i64) i64 = { if (a > b) { return a; }; return b; }; export fn abs_i32(x: i32) i32 = { if (x < 0) { return -x; }; return x; }; export fn abs_i64(x: i64) i64 = { if (x < 0) { return -x; }; return x; };