Matt S Trout > Rakudo-Star-2012.08_001 > bit.ops

# NAME

bit.ops - Bitwise Opcodes Dynoplib

# DESCRIPTION

Operations that deal with bits directly, either individually or in groups.

The variant with an appended s like bands work on strings.

band(invar PMC, in INT)
band(invar PMC, invar PMC)

Set the bits of \$1 according to the and of the corresponding bits from \$1 and \$2.

band(invar PMC, invar PMC, in INT)
band(invar PMC, invar PMC, invar PMC)

Set the bits of \$1 according to the and of the corresponding bits from \$2 and \$3.

bands(invar PMC, in STR)
bands(invar PMC, invar PMC)

Set the bits of \$1 according to the and of the corresponding bits from \$1 and \$2.

bands(out STR, in STR, in STR)
bands(invar PMC, invar PMC, in STR)
bands(invar PMC, invar PMC, invar PMC)

Set the bits of \$1 according to the and of the corresponding bits from \$2 and \$3.

bor(invar PMC, in INT)
bor(invar PMC, invar PMC)

Set the bits of \$1 according to the or of the corresponding bits from \$1 and \$2.

bor(invar PMC, invar PMC, in INT)
bor(invar PMC, invar PMC, invar PMC)

Set the bits of \$1 according to the or of the corresponding bits from \$2 and \$3.

bors(invar PMC, in STR)
bors(invar PMC, invar PMC)

Set the bits of \$1 according to the or of the corresponding bits from \$1 and \$2.

bors(out STR, in STR, in STR)
bors(invar PMC, invar PMC, in STR)
bors(invar PMC, invar PMC, invar PMC)

Set the bits of \$1 according to the or of the corresponding bits from \$2 and \$3.

shl(invar PMC, in INT)
shl(invar PMC, invar PMC)

Shift left \$1 by \$2 bits.

shl(invar PMC, invar PMC, in INT)
shl(invar PMC, invar PMC, invar PMC)

Set \$1 to the value of \$2 shifted left by \$3 bits.

shr(invar PMC, in INT)
shr(invar PMC, invar PMC)

Shift right \$1 by \$2 bits.

shr(invar PMC, invar PMC, in INT)
shr(invar PMC, invar PMC, invar PMC)

Set \$1 to the value of \$2 shifted right by \$3 bits.

bnot(inout INT)
bnot(invar PMC)

Sets \$1 to `bitwise not` \$1 inplace.

bnot(out INT, in INT)
bnot(out PMC, invar PMC)
bnots(invar PMC)
bnots(out STR, in STR)
bnots(out PMC, invar PMC)
lsr(invar PMC, in INT)
lsr(invar PMC, invar PMC)

Shift \$1 logically shifted right by \$2 bits.

lsr(invar PMC, invar PMC, in INT)
lsr(invar PMC, invar PMC, invar PMC)

Set \$1 to the value of \$2 logically shifted right by \$3 bits.

rot(out INT, in INT, in INT, inconst INT)

Rotate \$2 left or right by \$3 and place result in \$1. \$4 is the size of the word to rotate, max 32 on a 32-bit CPU and 64 on a 64-bit CPU. If the rotate count is negative a rotate right by abs(\$3) is performed.

bxor(invar PMC, in INT)
bxor(invar PMC, invar PMC)

Set the bits of \$1 according to the xor of the corresponding bits from \$1 and \$2.

bxor(invar PMC, invar PMC, in INT)
bxor(invar PMC, invar PMC, invar PMC)

Set the bits of \$1 according to the xor of the corresponding bits from \$2 and \$3.

bxors(invar PMC, in STR)
bxors(invar PMC, invar PMC)

Set the bits of \$1 according to the xor of the corresponding bits from \$1 and \$2.

bxors(out STR, in STR, in STR)
bxors(invar PMC, invar PMC, in STR)
bxors(invar PMC, invar PMC, invar PMC)

Set the bits of \$1 according to the xor of the corresponding bits from \$2 and \$3.