Closed oliverkwebb closed 2 months ago
In order to prevent inconsistent results across platforms these functions don't accept negative arguments in gawk.
$ exe/wak 'BEGIN{print and(-1,1)}'
1
$ gawk 'BEGIN{print and(-1,1)}'
gawk: cmd. line:1: fatal: and: argument 1 negative value -1 is not allowed
There is also this:
$ gawk 'BEGIN{print lshift(9000000000000000000,1)}'
18000000000000000000
$ exe/wak 'BEGIN{print lshift(9000000000000000000,1)}'
-446744073709551616
push_int_val
takes an argument of type ptrdiff_t
, you call it with an argument of type size_t
which may be greater than PTRDIFF_MAX
and lead to an implementation-defined result.
Adding these functions is pretty straightforward, also added test cases for them and some other builtin functions.