Difference between revisions of "Bit.blshift"

From ComputerCraft Wiki
Jump to: navigation, search
m (Reverted edits by 199.19.105.156 (talk) to last revision by Lyqyd)
m (Use type template)
Line 2: Line 2:
 
{{Function
 
{{Function
 
|name=bit.blshift
 
|name=bit.blshift
|args=[[int (type)|int]] n, [[int (type)|int]] bits
+
|args={{Type|int}} n, {{Type|int}} bits
 
|api=bit
 
|api=bit
|returns=[[int (type)|int]] the value of <var>n</var> shifted left by <var>bits</var> bits, which is equivalent to <var>n</var>×2<sup><var>bits</var></sup>
+
|returns={{Type|int}} the value of <var>n</var> shifted left by <var>bits</var> bits, which is equivalent to <var>n</var>×2<sup><var>bits</var></sup>
 
|addon=ComputerCraft
 
|addon=ComputerCraft
 
|desc=Shifts a number left by a specified number of bits
 
|desc=Shifts a number left by a specified number of bits

Revision as of 14:09, 22 April 2013


Grid Redstone.png  Function bit.blshift
Shifts a number left by a specified number of bits
Syntax bit.blshift(int n, int bits)
Returns int the value of n shifted left by bits bits, which is equivalent to n×2bits
Part of ComputerCraft
API bit

Examples

Grid paper.png  Example
Shift the number 18 (10010) left by 2 bits, yielding 72 (1001000)
Code
print(bit.blshift(18, 2))
Output 72