You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: scalar.go
    path of file: ./repos/fq/pkg/decode
    
    the code of the file until where you have to start completion: package decode

import (
	"bytes"
	"encoding/binary"
	"errors"

	"github.com/wader/fq/internal/bitioex"
	"github.com/wader/fq/pkg/bitio"
	"github.com/wader/fq/pkg/scalar"
)

func bitBufIsZero(s scalar.BitBuf, isValidate bool) (scalar.BitBuf, error) {
	br := s.Actual

	isZero := true
	// TODO: shared
	b := make([]byte, 32*1024)
	bLen := int64(len(b)) * 8
	brLen, err := bitioex.Len(br)
	if err != nil {
		return scalar.BitBuf{}, err
	}
	brLeft := brLen
	brPos := int64(0)

	for brLeft > 0 {
		rl := brLeft
		if brLeft > bLen {
			rl = bLen
		}
		// zero last byte if uneven read
		if rl%8 != 0 {
			b[rl/8] = 0
		}

		n, err := bitio.ReadAtFull(br, b, rl, brPos)
	
    
func bitBufIsZero(s scalar.BitBuf, isValidate bool) (scalar.BitBuf, error) {
	br := s.Actual

	isZero := true
	// TODO: shared
	b := make([]byte, 32*1024)
	bLen := int64(len(b)) * 8
	brLen, err := bitioex.Len(br)
	if err != nil {
		return scalar.BitBuf{}, err
	}
	brLeft := brLen
	brPos := int64(0)

	for brLeft > 0 {
		rl := brLeft
		if brLeft > bLen {
			rl = bLen
		}
		// zero last byte if uneven read
		if rl%8 != 0 {
			b[rl/8] = 0
		}

		n, err := bitio.ReadAtFull(br, b, rl, brPos)
		if err != nil {
			return s, err
		}
		nb := int(bitio.BitsByteCount(n))

		for i := 0; i < nb; i++ {
			if b[i] != 0 {
				isZero = false
				break
			}
		}

		brLeft -= n
	}

	if isZero {
		s.Description = "all zero"
	} else {
		s.Description = "all not zero"
		if isValidate {
			return s, errors.New("validate is zero failed")
		}
	}

	return s, nil
}