code wiki / (root) / nx_find_first_positive_test.nx

nx_find_first_positive_test.nx source

↩ module page · 15 lines · 434 B

1import "nx_syscalls.nx" 2import "nx_find_first_positive.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] = -1 8 arr[1] = -2 9 arr[2] = 3 10 arr[3] = 4 11 arr[4] = 5 12 if nx_find_first_positive(arr, 5) != 2 { return __syscall(93, 1, 0, 0, 0, 0, 0) } 13 if nx_find_first_positive(arr, 0) != -1 { return __syscall(93, 2, 0, 0, 0, 0, 0) } 14 return 0 15}