code wiki / (root) / _offc_bitset_probe.nx

_offc_bitset_probe.nx source

↩ module page · 15 lines · 438 B

1// Verify bit-set semantics work in NishiLang. 2// If this returns 32, bit-or + bit-and + shift work as expected. 3// If it returns 0, NishiLang has a quirk that breaks compute_liveness. 4 5import "syscalls.nx" 6 7func main() -> i64 { 8 let raw: *u8 = sys_mmap(64) 9 let buf: *i64 = raw as *i64 10 buf[0] = 0 11 let mask: i64 = 1 << 5 12 buf[0] = buf[0] | mask 13 let r: i64 = buf[0] & mask 14 return r // expect 32 15}