// Returns the value of the highest consecutive length bits, and returns true when corresponding
// to bit 1, otherwise false. If the length of bs is not enough, the actual length of the returned
// array may be less than length
Returns the value of the highest consecutive length bits, and returns true when corresponding
to bit 1, otherwise false. If the length of bs is not enough, the actual length of the returned
array may be less than length
// Returns the value of the highest consecutive length bits and returns true when corresponding // to bit 1 otherwise false . If the length of bs is not enough the actual length of the returned // array may be less than length
func (bs Bits) Bits(length int) []bool {
	if length <= 0 {
		return nil
	}
	r := make([]bool, 0, length)
	x := BitIndex(length).BytePos()
	y := BitIndex(length).BitPos()
	var j uint
	for i := 0; i < len(bs) && i <= x; i++ {
		for j = 0; j < 8; j++ {
			r = append(r, ((bs[i]>>(7-j))&0x1) == 0x1)
			if i >= x && j >= y {
				break
			}
		}
	}
	return r
}
func ( bs Bits ) Bits ( length int ) [ ] bool { if length <= 0 { return nil } r := make ( [ ] bool , 0 , length ) x := BitIndex ( length ) . BytePos ( ) y := BitIndex ( length ) . BitPos ( ) var j uint for i := 0 ; i < len ( bs ) && i <= x ; i ++ { for j = 0 ; j < 8 ; j ++ { r = append ( r , ( ( bs [ i ] >> ( 7 - j ) ) & 0x1 ) == 0x1 ) if i >= x && j >= y { break } } } return r }
Returns the value of the highest consecutive length bits, and returns true when corresponding
to bit 1, otherwise false.
Returns the value of the highest consecutive length bits and returns true when corresponding to bit 1 otherwise false .