Bit (API)

From ComputerCraft Wiki
Revision as of 00:52, 12 July 2013 by Watcher7 (Talk | contribs) (Int -> {{type|number}})

Jump to: navigation, search

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

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