bitops/bits.go
func msb64(n uint64) int {
	if n <= 0 {
		return -1
	}
	var r, v uint
	if n >= 1<<32 {
		r += 32
		v = uint(n >> 32)
	} else {
		v = uint(n)
	}
	if v >= 1<<16 {
		r += 16
		v >>= 16
	}
	if v >= 1<<8 {
		r += 8
		v >>= 8
	}
	if v >= 1<<4 {
		r += 4
		v >>= 4
	}
	if v >= 1<<2 {
		r += 2
		v >>= 2
	}
	r += v >> 1
	return int(r)
}
func msb64(n uint64) int {
	if n <= 0 {
		return -1
	}
	var r, v uint
	if n >= 1<<32 {
		r += 32
		v = uint(n >> 32)
	} else {
		v = uint(n)
	}
	if v >= 1<<16 {
		r += 16
		v >>= 16
	}
	if v >= 1<<8 {
		r += 8
		v >>= 8
	}
	if v >= 1<<4 {
		r += 4
		v >>= 4
	}
	if v >= 1<<2 {
		r += 2
		v >>= 2
	}
	r += v >> 1
	return int(r)
}
func msb64 ( n uint64 ) int { if n <= 0 { return - 1 } var r , v uint if n >= 1 << 32 { r += 32 v = uint ( n >> 32 ) } else { v = uint ( n ) } if v >= 1 << 16 { r += 16 v >>= 16 } if v >= 1 << 8 { r += 8 v >>= 8 } if v >= 1 << 4 { r += 4 v >>= 4 } if v >= 1 << 2 { r += 2 v >>= 2 } r += v >> 1 return int ( r ) }
// msb64 returns the number of bits required to store the value x
msb64 returns the number of bits required to store the value x