Difference between revisions of "Bitlib"

From Vendetta Lua
Jump to: navigation, search
(Functions)
m (Added to category.)
 
(One intermediate revision by one other user not shown)
Line 3: Line 3:
 
=== band ===
 
=== band ===
 
'''Definition:'''<br>
 
'''Definition:'''<br>
bit.band(w1,w2,...)
+
bitlib.band(w1,w2,...)
 
<br><br>
 
<br><br>
 
'''Description:''' <br>
 
'''Description:''' <br>
Line 9: Line 9:
 
<br><br>
 
<br><br>
 
'''Example:'''<br>
 
'''Example:'''<br>
print (bit.band (15, 3)) --> 3
+
print (bitlib.band (15, 3)) --> 3
 
<br><br>
 
<br><br>
  
Line 79: Line 79:
 
print (bitlib.lshift (-1024, 6)) --> 4294901760
 
print (bitlib.lshift (-1024, 6)) --> 4294901760
 
<br><br>
 
<br><br>
 +
 +
[[Category:Tables]]

Latest revision as of 22:41, 16 June 2009

Functions

band

Definition:
bitlib.band(w1,w2,...)

Description:
returns the bitwise and of the w's

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

bor

Definition:
bitlib.bor(w1,w2,...)

Description:
returns the bitwise or of the w's

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

bnot

Definition:
bitlib.bnot(a)

Description:
returns the one's complement of a

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

bxor

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

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

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

rshift

Definition:
bitlib.shift(a,b)

Description:
returns a shifted logically right b places

Example:
print (bitlib.rshift (-1024, 6)) --> 67108848


arshift

Definition:
bitlib.arshift(a,b)

Description:
returns a shifted logically right b places

Example:
print (bitlib.arshift (-1024, 6)) --> -16


lshift

Definition:
bitlib.lshift(a,b)

Description:
returns a shifted logically left b places

Example:
print (bitlib.lshift (-1024, 6)) --> 4294901760