You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
goip/vendor/github.com/saracen/go7z/headers/digests.go

26 lines
457 B

package headers
import (
"encoding/binary"
"io"
)
// ReadDigests reads an array of uint32 CRCs.
func ReadDigests(r io.Reader, length int) ([]uint32, error) {
defined, _, err := ReadOptionalBoolVector(r, length)
if err != nil {
return nil, err
}
crcs := make([]uint32, length)
for i := range defined {
if defined[i] {
if err := binary.Read(r, binary.LittleEndian, &crcs[i]); err != nil {
return nil, err
}
}
}
return crcs, nil
}