x |= -(x == 0);
x |= -!x;
x = x ? x : 0xFFFFFFFF;
-
if (x == 0)
x = 0xFFFFFFFF;…
Benchmark and choose what’s appropriate for you
4
solved Bithack for: if x is 0, then x should be -1, else x should be untouched
x |= -(x == 0);
x |= -!x;
x = x ? x : 0xFFFFFFFF;
if (x == 0)
x = 0xFFFFFFFF;
…
Benchmark and choose what’s appropriate for you
4
solved Bithack for: if x is 0, then x should be -1, else x should be untouched