ShiftRight instruction

21
Aug
Instruction ShiftRight
Syntax ShiftRight Destination, Source1, Source2[, Overflow-Label]
Constraints Destination and Source1 are of the same type, Source2 is a positive integer
Process Destination := shift_left(Source1, Source2)
If Overflow Detected Then Go To Overflow-Label

The ShiftRight instruction is used to shift bits to the left in an integer.

Overflows are not detected by default.

The overflow exception is raised when the resulting number loses bits.

There is no good way to detect bits loses unless the shift value (Source2) is 1.

It is possible to either mask Source2 to the number of bits defined in Source1 and Destination or to raise an exception.

Source2 may not be negative.