Bit

From Vendetta Lua
Revision as of 19:26, 5 June 2008 by BlackNet (Talk | contribs) (Functions)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Functions

band

Definition:
bit.band(w1,w2)

Description:
returns the bitwise and of the w's

Example:
print (bit.band (15, 3)) --> 3

bor

Definition:
bit.bor(w1,w2)

Description:
returns the bitwise or of the w's

Example:
print (bit.bor (13, 17)) --> 29

bnot

Definition:
bit.bnot(a)

Description:
returns the one's complement of a

Example:
print(bit.bnot(10)) --> 4294967285

bxor

Definition:
bit.bxor(w1,...)

Description:
returns the bitwise exclusive or of the w's

Example:
print (bit.xor (15, 1)) --> 14

brshift

Definition:
bit.rshift(a,b)

Description:
returns a shifted logically right b places

Example:
print (bit.brshift (-1024, 6)) --> 4294967285

bxor2

Definition:


(HTTPLIB) Description:


Example:
print (bit.xor (15, 1)) --> 14

tonumb

Definition:
bit.tonumb(bit_tbl) (HTTPLIB)

Description:
convert a bit table into a number

Example:


blshift

Definition:
bit.lshift(a,b) (HTTPLIB)

Description:
returns a shifted left b places

Example:
print (bit.blshift (4, 6)) --> 256

tobits

Definition:
bit.tobits(n) (HTTPLIB)

Description:
convert n into a bit table(which is a 1/0 sequence), high bits first

Example:


blogic_rshift

Definition:
bit.blogic_rshift(n, bits) (HTTPLIB)

Description:
logic right shift(zero fill >>>)

Example:
print (bit.blogic_rshift (144, 1)) --> 72