Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > It's not faster to just do something like > > int byte = 4; > > #if CONFIG_64BIT > byte = 8; > if (has_zero_32bit(value >> 32)) { > value >>= 32; > byte = 4; > } > #endif > if (has_zero_16(value >> 16)) { > value >>= 16; > byte -= 2; > } > if (!value & 0xff00) > byte--; > return byte; Could you use cpu_to_be32/64() and then ffs()? That ought to work for both variants of endianness. The cpu_to_beXX() should be a noop on BE and is likely to be a single instruction on LE. The meat of ffs() is usually a single instruction, though it may have to have zero-detect logic added. David -- To unsubscribe from this list: send the line "unsubscribe linux-arch" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html