github.com/vc42/parquet-go@v0.0.0-20240320194221-1a9adb5f23f5/encoding/delta/length_byte_array_purego.go (about)

     1  //go:build purego || !amd64
     2  
     3  package delta
     4  
     5  import (
     6  	"github.com/vc42/parquet-go/encoding/plain"
     7  )
     8  
     9  func decodeLengthByteArray(dst, src []byte, lengths []int32) ([]byte, error) {
    10  	for i := range lengths {
    11  		n := int(lengths[i])
    12  		if n < 0 {
    13  			return dst, errInvalidNegativeValueLength(n)
    14  		}
    15  		if n > len(src) {
    16  			return dst, errValueLengthOutOfBounds(n, len(src))
    17  		}
    18  		dst = plain.AppendByteArray(dst, src[:n])
    19  		src = src[n:]
    20  	}
    21  	return dst, nil
    22  }