simple9/encoding.go
func canPack(src []uint32, bits, n int) bool {
	if len(src) < n {
		return false
	}

	end := len(src)
	if n < end {
		end = n
	}

	max := uint32((2 << uint32(bits-1)) - 1)
	for i := 0; i < end; i++ {
		if src[i] > max {
			return false
		}
	}

	return true
}
func canPack(src []uint32, bits, n int) bool {
	if len(src) < n {
		return false
	}

	end := len(src)
	if n < end {
		end = n
	}

	max := uint32((2 << uint32(bits-1)) - 1)
	for i := 0; i < end; i++ {
		if src[i] > max {
			return false
		}
	}

	return true
}
func canPack ( src [ ] uint32 , bits , n int ) bool { if len ( src ) < n { return false } end := len ( src ) if n < end { end = n } max := uint32 ( ( 2 << uint32 ( bits - 1 ) ) - 1 ) for i := 0 ; i < end ; i ++ { if src [ i ] > max { return false } } return true }
// returns true if the next n values in in can be packed using bits bits
// per value.
returns true if the next n values in in can be packed using bits bits per value .