NAME ^

bit.ops - Bitwise Operations

DESCRIPTION ^

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

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

The variants with a prepended n_ like <n_bnot> generate a new target PMC. If possible, they use the appropriate language type, specified with .HLL.

band(inout INT, in INT)

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

band(out INT, in INT, in INT)

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

bands(inout STR, in STR)

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

bands(out STR, in STR, in STR)

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

bnot(inout INT)

bnot(in PMC)

Sets $1 to bitwise not $1 inplace.

bnot(out INT, in INT)

bnot(out PMC, in PMC)

n_bnot(out PMC, in PMC)

Set the bits of $1 to the not of the corresponding bits from $2.

bnots(inout STR)

bnots(in PMC)

bnots(out STR, in STR)

bnots(out PMC, in PMC)

n_bnots(out PMC, in PMC)

Set the bits of $1 to the not of the corresponding bits from $2.

bor(inout INT, in INT)

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

bor(out INT, in INT, in INT)

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

bors(inout STR, in STR)

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

bors(out STR, in STR, in STR)

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

shl(inout INT, in INT)

Shift left $1 by $2 bits.

shl(out INT, in INT, in INT)

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

shr(inout INT, in INT)

Shift right $1 by $2 bits.

shr(out INT, in INT, in INT)

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

lsr(out INT, in INT)

Shift $1 logically shifted right by $2 bits.

lsr(out INT, in INT, in INT)

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 amount of bits to rotate, 32 bit on a 32-bit CPU and 32 or 64 on a 64-bit CPU. If the rotate count is negative a rotate right by ($3+$4) is performed.

bxor(inout INT, in INT)

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

bxor(out INT, in INT, in INT)

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

bxors(inout STR, in STR)

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

bxors(out STR, in STR, in STR)

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

COPYRIGHT ^

Copyright (C) 2001-2004 The Perl Foundation. All rights reserved.

LICENSE ^

This program is free software. It is subject to the same license as the Parrot interpreter itself.


parrot