Difference between revisions of "Bit (API)"

From ComputerCraft Wiki
Jump to: navigation, search
m (Fixed table background colors.)
(Now perhaps jesusthekiller won't submit false bugreports.)
Line 35: Line 35:
 
</table>
 
</table>
  
The following functions used to exist in this API but no longer do:
+
 
 +
= Deprecated Functions =
 +
{{Deprecated
 +
|plural=yes
 +
|type=These functions
 +
}}
  
 
<table style="width: 100%; border: solid 1px black; margin: 2px; border-spacing: 0px;">
 
<table style="width: 100%; border: solid 1px black; margin: 2px; border-spacing: 0px;">

Revision as of 18:35, 1 June 2013

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

Grid disk.png  Bit (API)
ReturnMethod nameDescription
int value bit.blshift(int n, int bits) Shifts a number left by a specified number of bits.
int value bit.brshift(int n, int bits) Shifts a number right arithmetically by a specified number of bits.
int value bit.blogic_rshift(int n, int bits) Shifts a number right logically by a specified number of bits.
int value bit.bxor(int m, int n) Computes the bitwise exclusive OR of two numbers.
int value bit.bor(int m, int n) Computes the bitwise inclusive OR of two numbers.
int value bit.band(int m, int n) Computes the bitwise AND of two numbers.
int value bit.bnot(int n) Computes the bitwise NOT of a number.


Deprecated Functions

These functions have been deprecated.
These functions have been removed from ComputerCraft .
Grid disk.png  Bit (API)
ReturnMethod nameDescription
table bit_tbl bit.tobits(int n) Converts a number to an array (numerically-indexed table) containing the corresponding binary bit values.
int value bit.tonumb(table bit_tbl) Converts an array (numerically-indexed table) of 0 and 1 values representing a number in binary into that number.