Assembly: Bit Shifting

Posted June 15, 2006 by William_Wilson in Computer programming

To shift bits left or right by a desired number of places, follow the example provided in the tech-recipe below.

Bit shifting is an easy task.
To shift left (in this case by eight):

shl EAX,8

To shift right (in this case by eight):

shr EAX,8

You simply provide the two operands:
1) the register to shift
2) the number of places to shift

This method will automatically fill the slots without data as 0.

Questions/Comments: [email protected]
-William. ยง (marvin_gohan)

The Conversation

Follow the reactions below and share your own thoughts.