public static int Log2(int x) { if (x <= 0) { ExceptionUtil.ThrowArgumentOutOfRangeException("x", "must be positive"); } if (x == 1) { return(0); } return(UInt32Util.HighestBit((uint)x)); }
public static int HighestBit(int x) => UInt32Util.HighestBit((uint)x);