github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/libraries/klauspost/compress/flate/crc32_amd64.go (about)

     1  //+build !noasm
     2  //+build !appengine
     3  
     4  // Copyright 2015, Klaus Post, see LICENSE for details.
     5  
     6  package flate
     7  
     8  import (
     9  	"github.com/insionng/yougam/libraries/klauspost/cpuid"
    10  )
    11  
    12  // crc32sse returns a hash for the first 4 bytes of the slice
    13  // len(a) must be >= 4.
    14  //go:noescape
    15  func crc32sse(a []byte) hash
    16  
    17  // crc32sseAll calculates hashes for each 4-byte set in a.
    18  // dst must be east len(a) - 4 in size.
    19  // The size is not checked by the assembly.
    20  //go:noescape
    21  func crc32sseAll(a []byte, dst []hash)
    22  
    23  // matchLenSSE4 returns the number of matching bytes in a and b
    24  // up to length 'max'. Both slices must be at least 'max'
    25  // bytes in size.
    26  // It uses the PCMPESTRI SSE 4.2 instruction.
    27  //go:noescape
    28  func matchLenSSE4(a, b []byte, max int) int
    29  
    30  // histogram accumulates a histogram of b in h.
    31  // h must be at least 256 entries in length,
    32  // and must be cleared before calling this function.
    33  //go:noescape
    34  func histogram(b []byte, h []int32)
    35  
    36  // Detect SSE 4.2 feature.
    37  func init() {
    38  	useSSE42 = cpuid.CPU.SSE42()
    39  }