Description Usage Arguments Details Value See Also Examples
Logical operations on integer vectors with elements viewed as sets of bits.
1 2 3 4 5 6 7 | bitwNot(a)
bitwAnd(a, b)
bitwOr(a, b)
bitwXor(a, b)
bitwShiftL(a, n)
bitwShiftR(a, n)
|
a, b |
integer vectors; numeric vectors are coerced to integer vectors. |
n |
non-negative integer vector of values up to 31. |
Each element of an integer vector has 32 bits.
Pairwise operations can result in integer NA
.
Shifting is done assuming the values represent unsigned integers.
An integer vector of length the longer of the arguments, or zero length if one is zero-length.
The output element is NA
if an input is NA
(after
coercion) or an invalid shift.
The logical operators, !
, &
,
|
, 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.
1 2 3 4 5 6 | bitwAnd(15L, 7L)
bitwOr(15L, 7L)
bitwXor(15L, 7L)
bitwXor(-1L, 1L)
bitwShiftR(-1, 1:31) # shifts of 2^32-1 = 4294967295
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.