#Obtaining two's complement of an unsigned integer

1 messages · Page 1 of 1 (latest)

elfin smelt
#

In C, if I want to get the two's complement of x, I can get it with just -x. However, Zig compiler doesn't seem to allow that.

normal lion
#

I think it's -%?

#

Or maybe subtract with overflow from 0

elfin smelt
#

it just refuses to compile overflow

#

ahh

#

-% seems to work