bitops/bits.go
func msb32(x uint32) int {
	pos := 32
	temp := x >> 16
	if temp != 0 {
		pos -= 16
		x = temp
	}
	temp = x >> 8
	if temp != 0 {
		pos -= 8
		x = temp
	}
	temp = x >> 4
	if temp != 0 {
		pos -= 4
		x = temp
	}
	temp = x >> 2
	if temp != 0 {
		pos -= 2
		x = temp
	}
	temp = x >> 1
	if temp != 0 {
		return pos - 2
	}

	return int(uint32(pos) - x)
}
func msb32(x uint32) int {
	pos := 32
	temp := x >> 16
	if temp != 0 {
		pos -= 16
		x = temp
	}
	temp = x >> 8
	if temp != 0 {
		pos -= 8
		x = temp
	}
	temp = x >> 4
	if temp != 0 {
		pos -= 4
		x = temp
	}
	temp = x >> 2
	if temp != 0 {
		pos -= 2
		x = temp
	}
	temp = x >> 1
	if temp != 0 {
		return pos - 2
	}

	return int(uint32(pos) - x)
}
func msb32 ( x uint32 ) int { pos := 32 temp := x >> 16 if temp != 0 { pos -= 16 x = temp } temp = x >> 8 if temp != 0 { pos -= 8 x = temp } temp = x >> 4 if temp != 0 { pos -= 4 x = temp } temp = x >> 2 if temp != 0 { pos -= 2 x = temp } temp = x >> 1 if temp != 0 { return pos - 2 } return int ( uint32 ( pos ) - x ) }
// msb32 returns the number of bits required to store the value x
msb32 returns the number of bits required to store the value x