
Last chance! 50% off unlimited learning
Sale ends in
bitwNot(a)
bitwAnd(a, b)
bitwOr(a, b)
bitwXor(a, b)
bitwShiftL(a, n)
bitwShiftR(a, n)
NA
if an input is NA
(after
coercion) or an invalid shift.
Pairwise operations can result in integer NA
.
Shifting is done assuming the values represent unsigned integers.
!
, &
,
|
, xor
. The classes "octmode"
and "hexmnode"
whose
implementation of the standard logical operators is based on these
functions.
Package bitOps has similar functions for numeric vectors which differ in the way they treat integers $2^31$ or larger.
bitwAnd(15L, 7L)
bitwOr(15L, 7L)
bitwXor(15L, 7L)
bitwXor(-1L, 1L)
bitwShiftR(-1, 1:31) # shifts of 2^32-1 = 4294967295
Run the code above in your browser using DataLab