Bitwise left shift: <<, shl

Bit shift to the left as many time shifts the input number to the left as many as the value of the second input. output bits will be lost and the input bits will be 0. bit shift to the left can be used to multiply the power of 2. for example, when 8 is shifted twice the result is 32, it is the same as if multiplied 8 with two on second that is four and 4 multiplied with 8 is 32.

<<

Description

par1 << par2
Used keywords: <<

Input


Output

Compatible programing languages:
Visual Basic .NET | C | Visual C++ .NET | C++ | C# | Java | JavaScript | PHP

Examples

Example

Bitwise left shift the possible of use:
x = 16 << 2;      // x = 64
y = 0xf << 5;     // y = 480
z = (x << y) << 2;// z = 256

Example

Even one example in what situations we can use the operation bitwise left shift:
i << 4
0x12AB << j
128 << (j <<(3 + i))

Example

Other pieces of example codes:
2 << 2

shl

Description

par1 shl par2
Used keywords: shl

Input


Output

Compatible programing languages:
FreeBASIC | Pascal | Object Pascal | Free Pascal

Examples

Object Pascal

Bitwise left shift the possible of use:
x := 16 shl 2;      // x = 64
y := $f shl 5;     // y = 480
z := (x shl y) shl 2;// z = 256

Object Pascal

Even one example in what situations we can use the operation bitwise left shift:
i shl 4
$12AB shl j
128 shl (j shl(3 + i))

Object Pascal

Other pieces of example codes:
2 shl 2

You can find it in the following collections: bitwise operators
Languages: en hu cz sk