mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-04 01:53:42 +08:00 
			
		
		
		
	full diff: https://github.com/klauspost/compress/compare/v1.16.3...v1.17.2 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
		
			
				
	
	
		
			34 lines
		
	
	
		
			675 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			675 B
		
	
	
	
		
			Go
		
	
	
	
	
	
//go:build !amd64 || appengine || !gc || noasm
 | 
						|
// +build !amd64 appengine !gc noasm
 | 
						|
 | 
						|
// Copyright 2019+ Klaus Post. All rights reserved.
 | 
						|
// License information can be found in the LICENSE file.
 | 
						|
 | 
						|
package zstd
 | 
						|
 | 
						|
import (
 | 
						|
	"encoding/binary"
 | 
						|
	"math/bits"
 | 
						|
)
 | 
						|
 | 
						|
// matchLen returns the maximum common prefix length of a and b.
 | 
						|
// a must be the shortest of the two.
 | 
						|
func matchLen(a, b []byte) (n int) {
 | 
						|
	for ; len(a) >= 8 && len(b) >= 8; a, b = a[8:], b[8:] {
 | 
						|
		diff := binary.LittleEndian.Uint64(a) ^ binary.LittleEndian.Uint64(b)
 | 
						|
		if diff != 0 {
 | 
						|
			return n + bits.TrailingZeros64(diff)>>3
 | 
						|
		}
 | 
						|
		n += 8
 | 
						|
	}
 | 
						|
 | 
						|
	for i := range a {
 | 
						|
		if a[i] != b[i] {
 | 
						|
			break
 | 
						|
		}
 | 
						|
		n++
 | 
						|
	}
 | 
						|
	return n
 | 
						|
 | 
						|
}
 |