Contents | Prev | Next

8.2.8.7 Bit shift right (shr)

Description

As an extension to Standard Pascal, Irie Pascal supports the shr operator, which takes two operands of integral type and performs a right bit-shift. The result of the operation is of integral type, and is calculated by shifting to the right, 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 right by N bits is the same as dividing by 2 raised to the Nth power.

Example

   %11100 shr 3  results in %00011

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 shr 3   results in 3

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

Contents | Prev | Next