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.
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev