This documentation is out of date.
The new version of the documentation is here: https://cannylogic.com/docs |
Difference between revisions of "Left shift"
(Created page with " <div style="float:right;margin:5px;"> {|class="cannytable" width="350px" |- !colspan="2" style="background-color:#AFEEEE;"|Appearance |- |colspan="2" align="center" style="...") |
|||
Line 41: | Line 41: | ||
<div> | <div> | ||
− | Logical shift to the left. Set the output result as the logical left | + | Logical shift to the left. Set the output result as the logical left shift in binary representation of the input "Value", the number of bits to shift specified by the input "Shift, bit". |
</div> | </div> | ||
</div> | </div> | ||
<br clear="left"> | <br clear="left"> | ||
− | In other words, the result is equivalent to the result of copying each bit in binary representation of input "value" to its left position, to the number of times specified by the value of the input " | + | In other words, the result is equivalent to the result of copying each bit in binary representation of input "value" to its left position, to the number of times specified by the value of the input "Shift, bit" Thus, least significant (right-most) bit in the binary representation of the results each time gets a "0". |
Revision as of 04:38, 19 November 2015
Appearance | |
---|---|
Изображение:5_4_5_2.png | |
Symbol | |
<< | |
Group | |
Bitwise operators | |
Inputs | |
Value: | numeric |
Shift, bit: | numeric |
outputs | |
Result: | numeric |
Version CANNY Lab | |
from 0.6b |
Logical shift to the left. Set the output result as the logical left shift in binary representation of the input "Value", the number of bits to shift specified by the input "Shift, bit".
In other words, the result is equivalent to the result of copying each bit in binary representation of input "value" to its left position, to the number of times specified by the value of the input "Shift, bit" Thus, least significant (right-most) bit in the binary representation of the results each time gets a "0".
For example:
Value | = | 22 | = | 0x0016 | = | 0b0000000000010110 |
Shift, bit | = | 2 | ||||
Result | = | 88 | = | 0x0058 | = | 0b0000000001011000 |
Features
The result of values logical left shift:
for one bit — equivalent to the results of its arithmetic multiplication by 2
for two bits — equivalent to the results of its arithmetic multiplication by 4
for three bits — equivalent to the results of its arithmetic multiplication by 8
etc.
Examples
thumb|400px|Десятичное представление | thumb|500px|Двоичное представление |