Difference between revisions of "Bit (API)"

From ComputerCraft Wiki
Jump to: navigation, search
m
m (Methods: type listing inconsistencie fix. Bleh.)
Line 6: Line 6:
 
!style="background:#EEE" width="*"|Description
 
!style="background:#EEE" width="*"|Description
 
|-
 
|-
|[[bit.tobits]](n)
+
|[[bit.tobits]]([[number (type)|number]] n)
 
|Converts a number to an array (numerically-indexed table) containing the corresponding binary bit values
 
|Converts a number to an array (numerically-indexed table) containing the corresponding binary bit values
 
|-
 
|-
|[[bit.blshift]](n, bits)
+
|[[bit.blshift]]([[number (type)|number]] n, [[number (type)|number]] bits)
 
|Shifts a number left by a specified number of bits
 
|Shifts a number left by a specified number of bits
 
|-
 
|-
|[[bit.brshift]](n, bits)
+
|[[bit.brshift]]([[number (type)|number]] n, [[number (type)|number]] bits)
 
|Shifts a number right by a specified number of bits
 
|Shifts a number right by a specified number of bits
 
|-
 
|-
|[[bit.bxor]](m, n)
+
|[[bit.bxor]]([[number (type)|number]] m, [[number (type)|number]] n)
 
|Computes the bitwise exclusive OR of two numbers
 
|Computes the bitwise exclusive OR of two numbers
 
|-
 
|-
|[[bit.bor]](m, n)
+
|[[bit.bor]]([[number (type)|number]] m, [[number (type)|number]] n)
 
|Computes the bitwise inclusive OR of two numbers
 
|Computes the bitwise inclusive OR of two numbers
 
|-
 
|-
|[[bit.band]](m, n)
+
|[[bit.band]]([[number (type)|number]] m, [[number (type)|number]] n)
 
|Computes the bitwise AND of two numbers
 
|Computes the bitwise AND of two numbers
 
|-
 
|-
|[[bit.bnot]](n)
+
|[[bit.bnot]]([[number (type)|number]] n)
 
|Computes the bitwise NOT of a number
 
|Computes the bitwise NOT of a number
 
|-
 
|-
|[[bit.tonumb]](bit_tbl)
+
|[[bit.tonumb]]([[table (type)|table]] bit_tbl)
 
|Converts an array (numerically-indexed table) of 0 and 1 values representing a number in binary into that number
 
|Converts an array (numerically-indexed table) of 0 and 1 values representing a number in binary into that number
 
|}
 
|}
  
 
[[Category:APIs]]
 
[[Category:APIs]]

Revision as of 08:55, 25 November 2012

The Bit API is for manipulating numbers using bitwise binary operations.

Methods

Method name Description
bit.tobits(number n) Converts a number to an array (numerically-indexed table) containing the corresponding binary bit values
bit.blshift(number n, number bits) Shifts a number left by a specified number of bits
bit.brshift(number n, number bits) Shifts a number right by a specified number of bits
bit.bxor(number m, number n) Computes the bitwise exclusive OR of two numbers
bit.bor(number m, number n) Computes the bitwise inclusive OR of two numbers
bit.band(number m, number n) Computes the bitwise AND of two numbers
bit.bnot(number n) Computes the bitwise NOT of a number
bit.tonumb(table bit_tbl) Converts an array (numerically-indexed table) of 0 and 1 values representing a number in binary into that number