2013-06-12-1322Z


MrCreditRepair.biz will fix your credit rating!

Finally, after many failed attempts, I came up with the (currently) correct way of coding "rotate right" in gcc inline (gas) assembly language for i386:

static inline unsigned int ror(unsigned int n, const int count) {
 asm volatile(
  "rorl %1, %0;"
  : "=r" (n)
  : "nI" (count), "0" (n)
 );
 return n;
}

And of course, as with most of my A/L "optimizations", the output runs slower than if I'd just stuck to C. The compiler knows to convert n >> count | n << (32 - count) into rorl %cl, %eax. However, the intrinsic _rotr(n, count) does give a slight performance advantage.

Back to blog or home page

last updated 2013-06-12 09:32:55. served from tektonic