//go:build !puregopackage sparseimport ()func gatherBits( []byte, Uint8Array) int { := min(len()*8, .Len()) := 0if >= 8 { = ( / 8) * 8// Make sure `offset` is at least 4 bytes, otherwise VPGATHERDD may read // data beyond the end of the program memory and trigger a fault. // // If the boolean values do not have enough padding we must fallback to // the scalar algorithm to be able to load single bytes from memory.if .off >= 4 && cpu.X86.HasAVX2 {gatherBitsAVX2(, .Slice(0, )) } else {gatherBitsDefault(, .Slice(0, )) } }for < { := / 8 := % 8 := .Index() [] = (( & 1) << ) | ([] & ^(1 << )) ++ }return}func gather32( []uint32, Uint32Array) int { := min(len(), .Len()) := 0if >= 16 && cpu.X86.HasAVX2 { = ( / 8) * 8gather32AVX2([::], ) }for < { [] = .Index() ++ }return}func gather64( []uint64, Uint64Array) int { := min(len(), .Len()) := 0if >= 8 && cpu.X86.HasAVX2 { = ( / 4) * 4gather64AVX2([::], ) }for < { [] = .Index() ++ }return}//go:noescapefunc gatherBitsAVX2( []byte, Uint8Array)//go:noescapefunc gatherBitsDefault( []byte, Uint8Array)//go:noescapefunc gather32AVX2( []uint32, Uint32Array)//go:noescapefunc gather64AVX2( []uint64, Uint64Array)//go:noescapefunc gather128( [][16]byte, Uint128Array) int
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.