J
John
I have two numbers a,b.
I would like to compare if most significant bit of a is
larger than most significant bit of b. Right now the code
I am using looks like this
int w1,w2;
asm("bsr %0,%1" : "=r" (w1) : "r" (a));
asm("bsr %0,%1" : "=r" (w2) : "r" (b));
return w1 < w2;
Anyone has any better ideas on how to do this. Seems
like this code is pretty slow. Is there an easier way
to compare the msb of two numbers? Maybe using one
assembly command? Or maybe by doing something else
compared to bsr?
Thanks,
--j
I would like to compare if most significant bit of a is
larger than most significant bit of b. Right now the code
I am using looks like this
int w1,w2;
asm("bsr %0,%1" : "=r" (w1) : "r" (a));
asm("bsr %0,%1" : "=r" (w2) : "r" (b));
return w1 < w2;
Anyone has any better ideas on how to do this. Seems
like this code is pretty slow. Is there an easier way
to compare the msb of two numbers? Maybe using one
assembly command? Or maybe by doing something else
compared to bsr?
Thanks,
--j