github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/libraries/klauspost/compress/snappy/asm_amd64.go (about) 1 //+build !noasm 2 //+build !appengine 3 4 // Copyright 2015, Klaus Post, see LICENSE for details. 5 6 package snappy 7 8 import ( 9 "github.com/insionng/yougam/libraries/klauspost/cpuid" 10 ) 11 12 // matchLenSSE4 returns the number of matching bytes in a and b 13 // up to length 'max'. Both slices must be at least 'max' 14 // bytes in size. 15 // It uses the PCMPESTRI SSE 4.2 instruction. 16 //go:noescape 17 func matchLenSSE4(a, b []byte, max int) int 18 19 // Detect SSE 4.2 feature. 20 func init() { 21 useSSE42 = cpuid.CPU.SSE42() 22 } 23 24 // matchLenSSE4Ref is a reference matcher. 25 func matchLenSSE4Ref(a, b []byte, max int) int { 26 for i := 0; i < max; i++ { 27 if a[i] != b[i] { 28 return i 29 } 30 } 31 return max 32 }