This documentation is out of date.

The new version of the documentation is here: https://cannylogic.com/docs

Difference between revisions of "Left shift"

From CANNY Wiki
Jump to: navigation, search
[unchecked revision][unchecked revision]
 
(4 intermediate revisions by 2 users not shown)
Line 6: Line 6:
 
!colspan="2" style="background-color:#AFEEEE;"|Appearance
 
!colspan="2" style="background-color:#AFEEEE;"|Appearance
 
|-
 
|-
|colspan="2" align="center" style="padding:10px;"|[[Изображение:5_4_5_2.png]]
+
|colspan="2" align="center" style="padding:10px;"|[[File:5_4_5_2.png]]
 
|-
 
|-
 
!colspan="2" style="background-color:#AFEEEE;"|Symbol
 
!colspan="2" style="background-color:#AFEEEE;"|Symbol
Line 14: Line 14:
 
!colspan="2" style="background-color:#AFEEEE;"|Group
 
!colspan="2" style="background-color:#AFEEEE;"|Group
 
|-
 
|-
|colspan="2" align="center"|[[Built-in Function Blocks | Bitwise operators]]
+
|colspan="2" align="center"|[[Built-in Function Blocks#Bitwise operators | Bitwise operators]]
 
|-
 
|-
 
!colspan="2" style="background-color:#AFEEEE;"|Inputs
 
!colspan="2" style="background-color:#AFEEEE;"|Inputs
 
|-
 
|-
 
|style="padding-left:1em;"|Value:
 
|style="padding-left:1em;"|Value:
|style="padding-left:1em;"|[[numeric]]
+
|style="padding-left:1em;"|[[CFD Language#Data|Integer]]
 
|-
 
|-
|style="padding-left:1em;"|Shift, bit:
+
|style="padding-left:1em;"|Shift, bits:
|style="padding-left:1em;"|[[numeric]]
+
|style="padding-left:1em;"|[[CFD Language#Data|Integer]]
 
|-
 
|-
 
!colspan="2" style="background-color:#AFEEEE;"|outputs
 
!colspan="2" style="background-color:#AFEEEE;"|outputs
 
|-
 
|-
 
|style="padding-left:1em;"|Result:
 
|style="padding-left:1em;"|Result:
|style="padding-left:1em;"|[[numeric]]
+
|style="padding-left:1em;"|[[CFD Language#Data|Integer]]
 
|-
 
|-
 
!colspan="2" style="background-color:#AFEEEE;"|Version [[CANNY Lab]]
 
!colspan="2" style="background-color:#AFEEEE;"|Version [[CANNY Lab]]
Line 37: Line 37:
 
<div style="min-height:100%;display:block;">
 
<div style="min-height:100%;display:block;">
 
<div style="float:left;width:70px;">
 
<div style="float:left;width:70px;">
[[Изображение:5_4_5_1.png|left|Иконка]]
+
[[File:5_4_5_1.png|left|Icon]]
 
</div>
 
</div>
  
Line 60: Line 60:
 
|style="padding:5px;"|0b0000000000010110
 
|style="padding:5px;"|0b0000000000010110
 
|-
 
|-
|style="padding:5px;"|Shift, bit
+
|style="padding:5px;"|Shift, bits
 
|style="padding:5px;"|=
 
|style="padding:5px;"|=
 
|align="center"|2
 
|align="center"|2
Line 75: Line 75:
  
 
== Features ==
 
== Features ==
The result of values logical left shift:  
+
The result of logical left shift:  
  
 
for one bit — equivalent to the results of its arithmetic multiplication by 2
 
for one bit — equivalent to the results of its arithmetic multiplication by 2
Line 87: Line 87:
 
== Examples ==
 
== Examples ==
 
{|
 
{|
|[[Изображение:5_4_5_3.png|thumb|400px|Десятичное представление]]
+
|[[File:5_4_5_3.png|thumb|400px|As decimal]]
|[[Изображение:5_4_5_4.png|thumb|500px|Двоичное представление]]
+
|[[File:5_4_5_4.png|thumb|500px|As binary]]
 
|}
 
|}
  
Line 104: Line 104:
 
[[Left rotation]]
 
[[Left rotation]]
  
[[Right rotationо]]
+
[[Right rotation]]
  
[[Справочник по встроенным функциональным блокам | Встроенные функциональные блоки]]
+
[[Built-in_Function_Blocks | Built-in Function Blocks]]

Latest revision as of 17:56, 23 November 2015

Appearance
5 4 5 2.png
Symbol
<<
Group
Bitwise operators
Inputs
Value: Integer
Shift, bits: Integer
outputs
Result: Integer
Version CANNY Lab
from 0.6b
Icon

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, bits = 2
Result = 88 = 0x0058 = 0b0000000001011000

Features

The result of 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

As decimal
As binary

See also

Bitwise AND

Bitwise OR

Bitwise exclusive OR

Bitwise Inversion

Right shift

Left rotation

Right rotation

Built-in Function Blocks