Thread (6 messages) 6 messages, 5 authors, 2008-08-06

Re: inline assembly & r0 SOS

flat view

From: Segher Boessenkool <hidden>
Date: 2008-08-06 14:39:44

quoted
quoted
quoted
unsigned int get_PLL_range(unsigned int range, unsigned int config)
{
  range = range * 8 + 23;
  return ((config << range) | (config >> (32 - range))) & 3;
}

The special pattern ((a << n) | (a >> (32 - n))) is recognized by gcc as
a rotate operation.
It's only valid for 1 <= n <= 31 though, so for input "range" 0 or 1. (*)
If that's the whole range needed, much simpler code is possible...


Segher

(*) or 0xffffffff or 0xfffffffe, but somehow I doubt that was intended.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help