bit

Res = bit.bnot( value ): unary negation

 

Res = bit.band( v1, v2, ... ): bitwise "and"

 

Res = bit.bor( v1, v2, ... ): bitwise "or"

 

Res = bit.bxor( v1, v2, ... ): bitwise "exclusive or"

 

Res = bit.lshift( value, pos ): shift "value" left "pos" positions.

 

Res = bit.rshift( value, pos ): shift "value" right "pos" positions. The sign is

  not propagated.

 

Res = bit.arshift( value, pos ): shift "value" right "pos" positions. The sign

  is propagated ("arithmetic shift").

 

Res = bit.bit( bitno ): a shortcut for bit.lshift( 1, bitno )

 

Res1, Res2, ... = bit.set( bitno, v1, v2, ... ): set the bit at position "bitno"

  in v1, v2, ... to 1.

 

Res1, Res2, ... = bit.clear( bitno, v1, v2, ... ): set the bit at position

  "bitno"in v1, v2, ... to 0.

 

Res = bit.isset( value, bitno ): returns true if bit at position "bitno" in

  "value" is 1, false otherwise.

 

Res = bit.isclear( value, bitno ): returns true if bit at position "bitno" in

  "value" is 0, false otherwise.