Bitwise Shift Left (<<)

23.08.2021

Shifts the bits in an integer to the left by the specified number of positions.

Syntax

Expression << Number

The syntax of the << operator consists of the following elements:

Element

Description

Expression

Any expression. All integral data types are permitted.

Number

Same as Expression.

Remarks

Shifting one position to the left is the equivalent of multiplying by 2.

All integral data types are permitted. If one argument is numerical and the other is a string, the string is changed to numerical type before the operation. Both arguments cannot be strings.

The operator can process scalar values or entire data series and data matrices. If at least one argument is a data series or a data matrix, the operation takes place on a per-element basis and the result is once again a data series or a data matrix. If at least one of the two arguments is a data matrix, then both arguments must have the same number of rows. For a different number of columns in data matrices or for a different number of rows in data series, extra columns or values are removed.

If signals, signal series or space curves are used, only their Y components are taken into consideration. The result then preferably contains the X component and possibly the Z component of Expression. Otherwise, it contains those of Number. If one of the expressions returns a list, then the operation is executed for each item in the list and the result is also a list.

The operator is left-associative, i.e. sequences of operations are processed from left to right.

Available in

FlexPro View, Basic, Professional, Developer Suite

Examples

1n << 3n

Returns the 32-bit integer 8.

-1n << 2n

Returns the 32-bit integer -4.

0x8000s << 1s

Returns the 16-bit integer 0.

 

See Also

Bitwise Shift Right (>>)

Share article or send as email:

You might be interested in these articles