ROL

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

Signature

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

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

Inputs

Name

Type

Description

IN

ANY_BIT

The bit string to rotate.

N

ANY_INT

Number of positions to rotate left.

Outputs

Name

Type

Description

Return value

ANY_BIT

IN rotated left by N positions, with bits wrapping from the leftmost to the rightmost position. Same type as IN.

Description

Rotates the bit string IN left by N positions. Bits shifted out of the leftmost position wrap around to the rightmost position. No bits are lost.

Example

result := ROL(WORD#16#F000, 4);        (* result = 16#000F *)

See Also

  • ROR — rotate right

  • SHL — shift left

  • SHR — shift right

References