AnsweredAssumed Answered

Efficiently reverse 3-bits numbers.

Question asked by Yaniv.Sapir on Jul 25, 2011
Latest reply on Jul 26, 2011 by Yaniv.Sapir

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;


Outcomes