Difference between revisions of "Bit (API)"

From ComputerCraft Wiki
Jump to: navigation, search
m (Updated icon (test).)
m (Moved summary out (test).)
Line 1: Line 1:
<table style="width: 100%; border: solid 1px black; margin: 2px; border-spacing: 0px;">
+
The Bit API is for manipulating numbers using bitwise binary operations.
<tr><td colspan="2" style="font-weight: bold; font-size: large; padding-bottom: .3em; border-bottom: solid #C9C9C9 1px; background: #DBE5FF; line-height:28px;">[[File:Grid_disk.png|24px]]&nbsp;&nbsp;Bit (API)</td></tr>
+
<tr style="background-color: #FFFFFF;"><td colspan="2" style="padding: .4em; padding-bottom: .8em;">The Bit API is for manipulating numbers using bitwise binary operations.</td></tr>
+
  
 +
<table style="width: 100%; border: solid 1px black; margin: 2px; border-spacing: 0px;">
 +
<tr><td colspan="2" style="font-weight: bold; font-size: large; padding-bottom: .3em; border-bottom: solid #C9C9C9 1px; background: #D3FFC2; line-height:28px;">[[File:Grid_disk.png|24px]]&nbsp;&nbsp;Bit (API)</td></tr>
  
 
<tr><td style="width: 350px; background: #E0E0E0; padding: .4em; font-weight:bold;">Method name</td><td style="background: #E0E0E0; padding: .4em; font-weight:bold;">Description</td></tr>
 
<tr><td style="width: 350px; background: #E0E0E0; padding: .4em; font-weight:bold;">Method name</td><td style="background: #E0E0E0; padding: .4em; font-weight:bold;">Description</td></tr>

Revision as of 21:50, 30 November 2012

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

Grid disk.png  Bit (API)
Method nameDescription
bit.tobits(int n) Converts a number to an array (numerically-indexed table) containing the corresponding binary bit values.
bit.blshift(int n, int bits) Shifts a number left by a specified number of bits.
bit.brshift(int n, int bits) Shifts a number right by a specified number of bits.
bit.bxor(int m, int n) Computes the bitwise exclusive OR of two numbers.
bit.bor(int m, int n) Computes the bitwise inclusive OR of two numbers.
bit.band(int m, int n) Computes the bitwise AND of two numbers.
bit.bnot(int 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.