Bit API

Revision as of 01:13, 25 December 2012 by Mastergalen (talk | contribs) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

Methods

Method name Description Return type
bit.tobits(n) Converts a number to an array (numerically-indexed table) containing the corresponding binary bit values table the bits making up the value n, with entries up to the most-significant 1 bit in n
bit.blshift(n, bits) Shifts a number left by a specified number of bits int the value of n shifted left by bits bits, which is equivalent to n×2^bits
bit.brshift(n, bits) Shifts a number right by a specified number of bits int the value of n shifted right by bits bits, which is equivalent to ⌊n÷2^bits⌋
bit.bxor(m, n) Computes the bitwise exclusive OR of two numbers int the value of m XOR n
bit.bor(m, n) Computes the bitwise inclusive OR of two numbers int the value of m OR n
bit.band(m, n) Computes the bitwise AND of two numbers int the value of m AND n
bit.bnot(n) Computes the bitwise NOT of a number int the value of NOT n
bit.bnot(bit_tbl) Converts an array (numerically-indexed table) of 0 and 1 values representing a number in binary into that number int the number resulting from the conversion of bit_tbl from binary
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Need wiki hosting?

Do you need a wiki for your Minecraft mod/gaming wiki? We'll host it for free! Contact us.

Other wikis

Indie-game wikis
Powered by Indie Wikis