github.com/segmentio/parquet-go@v0.0.0-20230712180008-5d42db8f0d47/internal/bitpack/unpack_int64_amd64.go (about)

     1  //go:build !purego
     2  
     3  package bitpack
     4  
     5  import (
     6  	"github.com/segmentio/parquet-go/internal/unsafecast"
     7  	"golang.org/x/sys/cpu"
     8  )
     9  
    10  //go:noescape
    11  func unpackInt64Default(dst []int64, src []byte, bitWidth uint)
    12  
    13  //go:noescape
    14  func unpackInt64x1to32bitsAVX2(dst []int64, src []byte, bitWidth uint)
    15  
    16  func unpackInt64(dst []int64, src []byte, bitWidth uint) {
    17  	hasAVX2 := cpu.X86.HasAVX2
    18  	switch {
    19  	case hasAVX2 && bitWidth <= 32:
    20  		unpackInt64x1to32bitsAVX2(dst, src, bitWidth)
    21  	case bitWidth == 64:
    22  		copy(dst, unsafecast.BytesToInt64(src))
    23  	default:
    24  		unpackInt64Default(dst, src, bitWidth)
    25  	}
    26  }