mirror of
https://github.com/hanzoai/traces.git
synced 2026-10-30 18:20:41 +00:00
* Upgrade parquet-go to latest for StructTag option * Upgrade parquet-go to get latest alloc fix
37 lines
918 B
Go
37 lines
918 B
Go
//go:build !purego
|
|
|
|
package bitpack
|
|
|
|
import (
|
|
"github.com/parquet-go/bitpack/unsafecast"
|
|
"golang.org/x/sys/cpu"
|
|
)
|
|
|
|
//go:noescape
|
|
func unpackInt32Default(dst []int32, src []byte, bitWidth uint)
|
|
|
|
//go:noescape
|
|
func unpackInt32x1to16bitsAVX2(dst []int32, src []byte, bitWidth uint)
|
|
|
|
//go:noescape
|
|
func unpackInt32x17to26bitsAVX2(dst []int32, src []byte, bitWidth uint)
|
|
|
|
//go:noescape
|
|
func unpackInt32x27to31bitsAVX2(dst []int32, src []byte, bitWidth uint)
|
|
|
|
func unpackInt32(dst []int32, src []byte, bitWidth uint) {
|
|
hasAVX2 := cpu.X86.HasAVX2
|
|
switch {
|
|
case hasAVX2 && bitWidth <= 16:
|
|
unpackInt32x1to16bitsAVX2(dst, src, bitWidth)
|
|
case hasAVX2 && bitWidth <= 26:
|
|
unpackInt32x17to26bitsAVX2(dst, src, bitWidth)
|
|
case hasAVX2 && bitWidth <= 31:
|
|
unpackInt32x27to31bitsAVX2(dst, src, bitWidth)
|
|
case bitWidth == 32:
|
|
copy(dst, unsafecast.Slice[int32](src))
|
|
default:
|
|
unpackInt32Default(dst, src, bitWidth)
|
|
}
|
|
}
|