Contents | Prev | Next

8.2.8.6 Bit shift left (shl)

Description

As an extension to Standard Pascal, Irie Pascal supports the shl operator, which takes two operands of integral type and performs a left bit-shift. The result of the operation is of integral type, and is calculated by shifting to the left, the bits in the left operand, by the number of places specified by the right operand. The right operand must be greater than or equal to zero. NOTE: Bit-shifting left by N bits is the same as multiplying by 2 raised to the Nth power.

Example

   %11100 shl 3  results in %11100000

Binary notation is used in the example above so that you can clearly see the individual bits in the operands and the result. The example above could have been written as

   28 shl 3   results in 224

which is the same thing, but is probably not as clear.

Contents | Prev | Next