Module cream.bit

Bitwise API

Author:

David Delassus <david.jose.delassus@gmail.com>

Functions

band (x1, x2...) Bitwise and of x1, x2, ...
bnot (x) Bitwise not of x
bor (x1, x2...) Bitwise or of x1, x2, ...
bxor (x1, x2...) Bitwise xor of x1, x2, ...
lshift (x, n) Left-shift of x by n bits
rol (x, n) Left-rotate of x by n bits
ror (x, n) Right-rotate of x by n bits
rshift (x, n) Right-shift of x by n bits


Functions

band (x1, x2...)
Bitwise and of x1, x2, ...

Parameters

  • x1: Number
  • x2...: Numbers

Return value:

Bitwise and of x1, x2, ...
bnot (x)
Bitwise not of x

Parameters

  • x: Number

Return value:

Bitwise not of x
bor (x1, x2...)
Bitwise or of x1, x2, ...

Parameters

  • x1: Number
  • x2...: Numbers

Return value:

Bitwise or of x1, x2, ...
bxor (x1, x2...)
Bitwise xor of x1, x2, ...

Parameters

  • x1: Number
  • x2...: Numbers

Return value:

Bitwise xor of x1, x2, ...
lshift (x, n)
Left-shift of x by n bits

Parameters

  • x: Number
  • n: Number of bits

Return value:

Left-shift of x by n bits
rol (x, n)
Left-rotate of x by n bits

Parameters

  • x: number
  • n: Number of bits

Return value:

Left-rotate of x by n bits
ror (x, n)
Right-rotate of x by n bits

Parameters

  • x: number
  • n: Number of bits

Return value:

Right-rotate of x by n bits
rshift (x, n)
Right-shift of x by n bits

Parameters

  • x: Number
  • n: Number of bits

Return value:

Right-shift of x by n bits

Valid XHTML 1.0!