bitFlip {bitops} | R Documentation |
The binary flip (not) operator, bitFlip(a, w)
, “flips every
bit” of a
up to the w
-th bit.
bitFlip(a, bitWidth=32)
a |
numeric vector. |
bitWidth |
scalar integer between 0 and 32. |
binary numeric vector of the same length as a
masked with
(2^bitWidth
)-1. NA
is returned for any value of
a
that is not finite or whose magnitude is greater or equal to
2^{32}.
Steve Dutky
stopifnot( bitFlip(-1) == 0, bitFlip(0 ) == 2^32 - 1, bitFlip(0, bitWidth=8) == 255 )