Difference between revisions of "Bit.blogic rshift"
From ComputerCraft Wiki
(New page for new function) |
m (Missing template close) |
||
| Line 17: | Line 17: | ||
|code=print(bit.blogic_rshift(2147483648, 2)) | |code=print(bit.blogic_rshift(2147483648, 2)) | ||
|output=536870912 | |output=536870912 | ||
| + | }} | ||
}} | }} | ||
[[Category:API_Functions]] | [[Category:API_Functions]] | ||
Revision as of 18:11, 21 April 2013
| 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
| Shift the number 73 (1001001) right by 2 bits, yielding 18 (10010) | |
| Code |
print(bit.blogic_rshift(73, 2)) |
| Output | 18 |