# The Dromesday Book

### Site Tools

lgscript:bit_library

# Bit32 Library

Functions that manipulate numbers as 32-bit integers. Input numbers can be as low as -231 and as high as 232-1. (Some of those numbers will have the same binary representation.) The processing is done using unsigned 32-bit numbers, so the return values are always greater than or equal to 0.

## arshift

Arithmetic right shift.

 Returns Parameter number The shifted value. number A bitfield value. number Number of places to shift.

Shift the bits in the number to the right. The bits shifted in from the left will be the same as the previous high-order bit. A negative shift will go to the left and set the low-order bits to 0.

## band

Bitwise and of the given numbers.

 Returns Parameter number The and’ed value. number `...` Values to and together.

## bnot

Bitwise not of the number.

 Returns Parameter number The inverted value. number Value to invert.

## bor

Bitwise or of the given numbers.

 Returns Parameter number The or’ed value. number `...` Values to or together.

## btest

Do bitwise and and test the result.

 Returns Parameter boolean True if the result is not zero. number `...` Values to and together.

## bxor

Bitwise xor of the given numbers.

 Returns Parameter number The xored value. number `...` Values to xor together.

## lrotate

Left rotate.

 Returns Parameter number The shifted value. number A bitfield value. number Number of places to shift.

Shift the bits in the number to the left. A negative shift will go to the right. Each bit removed from the left side will be inserted on the right side. So the number will restore itself if shifted 32 places.

## lshift

Left shift.

 Returns Parameter number The shifted value. number A bitfield value. number Number of places to shift.

Shift the bits in the number to the left. A negative shift will go to the right. The shifted in bits are set to 0.

## rrotate

Right rotate.

 Returns Parameter number The shifted value. number A bitfield value. number Number of places to shift.

Shift the bits in the number to the right. A negative shift will go to the left. Each bit removed from the right side will be inserted on the left side. So the number will restore itself if shifted 32 places.

## rshift

Right shift.

 Returns Parameter number The shifted value. number A bitfield value. number Number of places to shift.

Shift the bits in the number to the right. A negative shift will go to the left. The shifted in bits are set to 0.

lgscript/bit_library.txt · Last modified: 2011/05/21 01:54 by telliamed

### Page Tools 