SHL

Shifts a bit string left by a specified number of positions.

Signature

    ┌─────────┐
IN ─┤         │
    │   SHL   ├─ OUT
 N ─┤         │
    └─────────┘
FUNCTION SHL : ANY_BIT
  VAR_INPUT
    IN : ANY_BIT;
    N  : ANY_INT;
  END_VAR
END_FUNCTION

The return type matches the type of IN. SHL accepts BYTE, WORD, DWORD, LWORD for IN; N is INT.

Inputs

Name

Type

Description

IN

ANY_BIT

The bit string to shift.

N

ANY_INT

Number of positions to shift left.

Outputs

Name

Type

Description

Return value

ANY_BIT

IN shifted left by N positions, with zeros filled in on the right. Same type as IN.

Description

Shifts the bit string IN left by N positions. Vacated positions on the right are filled with zeros. Bits shifted beyond the leftmost position are discarded.

Example

result := SHL(WORD#16#00FF, 8);        (* result = 16#FF00 *)

See Also

  • SHR — shift right

  • ROL — rotate left

  • ROR — rotate right

References