Intro Reference Guide Book Install Guide Download Changelog Zenmap GUI Docs Bug Reports OS Detection Propaganda Related Projects In the Movies In the News

# Library `bit`

Bitwise operations on integers.

THIS LIBRARY IS DEPRECATED, Please use native Lua 5.3 bitwise operators.

## Functions

 arshift (a, b) Returns `a` arithmetically right-shifted by `b` places. band (a, b, ...) Returns the bitwise and of all its arguments. bnot (a) Returns the one's complement of `a`. bor (a, b, ...) Returns the bitwise or of all its arguments. bxor (a, b, ...) Returns the bitwise exclusive or of all its arguments. lshift (a, b) Returns `a` left-shifted by `b` places. mod (a, b) Returns the integer remainder of `a` divided by `b`. rshift (a, b) Returns `a` right-shifted by `b` places.

## Functions

arshift (a, b)

Returns `a` arithmetically right-shifted by `b` places.

### Parameters

• a: Number to perform the shift on.
• b: Number of shifts.
band (a, b, ...)

Returns the bitwise and of all its arguments.

REPLACEMENT: `a & b`

### Parameters

• a:
• b:
• ...: A variable number of Numbers to and.

### Return value:

The anded result.
bnot (a)

Returns the one's complement of `a`.

REPLACEMENT: `~a`

• a: Number.

### Return value:

The one's complement of `a`.
bor (a, b, ...)

Returns the bitwise or of all its arguments.

REPLACEMENT: `a | b`

### Parameters

• a:
• b:
• ...: A variable number of Numbers to or.

### Return value:

The ored result.
bxor (a, b, ...)

Returns the bitwise exclusive or of all its arguments.

REPLACEMENT: `a ~ b`

### Parameters

• a:
• b:
• ...: A variable number of Numbers to exclusive or.

### Return value:

The exclusive ored result.
lshift (a, b)

Returns `a` left-shifted by `b` places.

REPLACEMENT: `a << b`

### Parameters

• a: Number to perform the shift on.
• b: Number of shifts.
mod (a, b)

Returns the integer remainder of `a` divided by `b`.

REPLACEMENT: `a % b`

### Parameters

• a: Dividend.
• b: Divisor.
rshift (a, b)

Returns `a` right-shifted by `b` places.

REPLACEMENT: `a >> b`

### Parameters

• a: Number to perform the shift on.
• b: Number of shifts.