Difference between revisions of "Bit.blogic rshift"
From ComputerCraft Wiki
m (Missing template close) |
m (Use type template) |
||
Line 2: | Line 2: | ||
{{Function | {{Function | ||
|name=bit.blogic_rshift | |name=bit.blogic_rshift | ||
− | |args= | + | |args={{Type|int}} n, {{Type|int}} bits |
|api=bit | |api=bit | ||
− | |returns= | + | |returns={{Type|int}} the value of <var>n</var> shifted right by <var>bits</var> bits, with the shifted-in bits all being zero, which is equivalent to ⌊<var>n</var>÷2<sup><var>bits</var></sup>⌋ for nonnegative numbers |
|addon=ComputerCraft | |addon=ComputerCraft | ||
|desc=Shifts a number right logically by a specified number of bits | |desc=Shifts a number right logically by a specified number of bits |
Revision as of 14:16, 22 April 2013
Function bit.blogic_rshift | |
Shifts a number right logically by a specified number of bits | |
Syntax | bit.blogic_rshift(int n, int bits) |
Returns | int the value of n shifted right by bits bits, with the shifted-in bits all being zero, which is equivalent to ⌊n÷2bits⌋ for nonnegative numbers |
Part of | ComputerCraft |
API | bit |
Examples
Example | |
Shift the number 73 (1001001) right by 2 bits, yielding 18 (10010) | |
Code |
print(bit.blogic_rshift(73, 2)) |
Output | 18 |