On Wed, Mar 2, 2011 at 11:22 PM, <[email protected]> wrote: > + > +static int convert_from_bytes_to_power_of_two(unsigned int x) > +{ > + int y = 0; > + y = (x & 0xAAAA) ? 1 : 0; > + y |= ((x & 0xCCCC) ? 1 : 0) << 1; > + y |= ((x & 0xF0F0) ? 1 : 0) << 2; > + y |= ((x & 0xFF00) ? 1 : 0) << 3; > + > + return y; > +}
Let's not try to be this clever. U-Boot already has a function that tells you which power of two a number corresponds to. Unless the caller of this will be highly sensitive to several cycles that you may gain from knowing that the input is already a power-of-two, there's just no cause to creating a separate implementation of ffs(). Other than that, it looks fine, and as soon as you respin, I'll add it to the mmc tree. Andy _______________________________________________ U-Boot mailing list [email protected] http://lists.denx.de/mailman/listinfo/u-boot

