Rope Language Reference - 'lshift' And 'rshift'

The 'lshift' action pops two integer numbers off the top of the stack and shifts all the bits in the first one to the left by the number of places specified in the second.

The "rshift" action does the same thing, but moves the bits to the right instead of to the left.

For example: the number 123 can be represented in binary as

 0000 0000 0111 1011

Calling the action

  123 2 lshift
or ..
  lshift(123 2)

Shifts all the bits in the number 123 two places to the left so we get (in binary)..

 0000 0001 1110 1100

Which is 492 in decimal.

This shifting is done using the "long integer" representation on the platform (32 bits in intel systems). Any bits that "fall off" the left hand end (or right hand end - in the case of 'rshift') of the number as a result of being shift are thrown away.