I am looking for ideas for efficiently reversing 3-bit numbers in a register. Something faster than this:

// 3 lsb's of r0 [........cba] to be reversed into r2 [.......abc]

// (destructive operation may be acceptable too).

r1 = rot r0 by -1;

r2 = rot r2 by 1;

r1 = rot r0 by -2;

r2 = rot r2 by 1;

r1 = rot r0 by -3;

r2 = rot r2 by 1;

Hi Yaniv,

Are you looking to reverse only the 3-LSBs of a 32 bit register, preserving the rest of the bits? That's a little different from your title of reversing 3-bit numbers.

Gabby