DataFixerUpper
DataFixerUpper copied to clipboard
micro optimization
use a faster calculation of the power of two closest to input - 1, which uses bitwise operations at the hardware level (Intrinsic)
What about return (-1 >>> Integer.numberOfLeadingZeros(input - 1)) + 1;? Makes the function into one line
What about return (-1 >>> Integer.numberOfLeadingZeros(input - 1)) + 1;? Makes the function into one line
Yeah, thanks, that's better.