bitFlip {bitops}R Documentation

Binary Flip (Not) Operator

Description

Binary flop (not) operator.

Usage

bitFlip(a, bitWidth=32)

Arguments

a

numeric vector.

bitWidth

scalar integer between 0 and 32.

Value

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}.

Author(s)

Steve Dutky

See Also

bitShiftL, bitXor, etc.

Examples

 stopifnot(
  bitFlip(-1) == 0,
  bitFlip(0 ) == 4294967295,
  bitFlip(0, bitWidth=8) == 255
 )

[Package bitops version 1.0-5 Index]