I am learning solidity and found this bit of a mistake in your explaination of the code
the code I am refering to is in Bitwiser.sol
your code
// Get position of most significant bit
// x = 1100 = 10, most significant bit = 1000, so this function will return 3
function mostSignificantBit(uint256 x) external pure returns (uint256) {
uint256 i = 0;
while ((x >>= 1) > 0) {
++i;
}
return i;
}
in the second comment 1100 should be equals to 12 not 10
1100 => 8 + 4 + 0 + 0 => 12
Hey man,
I am learning solidity and found this bit of a mistake in your explaination of the code the code I am refering to is in
Bitwiser.sol
in the second comment 1100 should be equals to 12 not 10 1100 => 8 + 4 + 0 + 0 => 12