Difference between revisions of "Bit.blshift"
From ComputerCraft Wiki
(Create page) |
m (Changed nonexistent type int to type number.) |
||
| (9 intermediate revisions by 8 users not shown) | |||
| Line 2: | Line 2: | ||
{{Function | {{Function | ||
|name=bit.blshift | |name=bit.blshift | ||
| − | |args= | + | |args={{Type|number}} n, {{Type|number}} bits |
|api=bit | |api=bit | ||
| − | |returns= | + | |returns={{Type|number}} 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 | ||
| Line 14: | Line 14: | ||
}} | }} | ||
}} | }} | ||
| + | |||
| + | [[Category:API_Functions]] | ||
Latest revision as of 01:00, 12 July 2013
| Shifts a number left by a specified number of bits | |
| Syntax | bit.blshift(number n, number bits) |
| Returns | number the value of n shifted left by bits bits, which is equivalent to n×2bits |
| Part of | ComputerCraft |
| API | bit |
Examples
| Shift the number 18 (10010) left by 2 bits, yielding 72 (1001000) | |
| Code |
print(bit.blshift(18, 2)) |
| Output | 72 |