Infix Bitwise Operators {vectorbitops}R Documentation

Infix operators for bitwise operations.

Description

Basic infix wrapper around the base::bitw_OP_ operations.

Usage

a %|% b

a %&% b

a %^% b

a %<<% n

a %>>% n

Arguments

a, b

Integer vectors. Numerics are coerced to integers.

n

Non-negative integer vector of values up to 31.

Value

An integer vector of length of the longer of the arguments, or zero if one of the arguments is zero-length. NA input makes NA output.

⁠%|%⁠: A vector of pairwise ORed values.

⁠%&%⁠: A vector of pairwise ANDed values.

⁠%^%⁠: A vector of pairwise XORed values.

⁠%<<%⁠: A vector of the values on the LHS pairwise left-shifted by the RHS value.

⁠%>>%⁠: A vector of the values on the LHS pairwise right-shifted by the RHS value.

Examples

1 %|% 2
1 %&% 2
1 %^% 2
1 %<<% 2
8 %>>% 2

[Package vectorbitops version 1.1.2 Index]