code wiki / (root) / nx_decrement_inplace_test.nx

nx_decrement_inplace_test.nx source

↩ module page · 15 lines · 449 B

1import "nx_syscalls.nx" 2import "nx_decrement_inplace.nx" 3 4func main() -> nx_int { 5 let buf: *u8 = sys_mmap(80) 6 let arr: *nx_int = buf as *nx_int 7 arr[0] = 5 8 arr[1] = 0 9 arr[2] = -3 10 nx_decrement_inplace(arr, 3) 11 if arr[0] != 4 { return __syscall(93, 1, 0, 0, 0, 0, 0) } 12 if arr[1] != -1 { return __syscall(93, 2, 0, 0, 0, 0, 0) } 13 if arr[2] != -4 { return __syscall(93, 3, 0, 0, 0, 0, 0) } 14 return 0 15}