github.com/parquet-go/parquet-go@v0.20.0/internal/bitpack/unpack_int64_amd64.go (about)

     1  //go:build !purego
     2  
     3  package bitpack
     4  
     5  import (
     6  	"github.com/parquet-go/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  }