Bit shift right (shr)


As an extension to Standard Pascal, Irie Pascal supports the shr operator, which takes two operands (left and right) of integral type and performs a right bit-shift operation. 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, for positive operands.


   %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.