Use 32-bit loads in isMatch1 and isMatch5.
This commit is contained in:
parent
8f8b18645c
commit
097c1c5bc9
|
@ -33,14 +33,8 @@ func hashBytesAtOffset5(v uint64, offset int, shift uint) uint32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
func isMatch5(p1 []byte, p2 []byte) bool {
|
func isMatch5(p1 []byte, p2 []byte) bool {
|
||||||
var i int
|
return binary.LittleEndian.Uint32(p1) == binary.LittleEndian.Uint32(p2) &&
|
||||||
for i = 0; i < 5; i++ {
|
p1[4] == p2[4]
|
||||||
if p1[i] != p2[i] {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Builds a literal prefix code into "depths" and "bits" based on the statistics
|
/* Builds a literal prefix code into "depths" and "bits" based on the statistics
|
||||||
|
|
|
@ -30,15 +30,14 @@ func hashBytesAtOffset(v uint64, offset uint, shift uint, length uint) uint32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
func isMatch1(p1 []byte, p2 []byte, length uint) bool {
|
func isMatch1(p1 []byte, p2 []byte, length uint) bool {
|
||||||
var i uint
|
if binary.LittleEndian.Uint32(p1) != binary.LittleEndian.Uint32(p2) {
|
||||||
for i = 0; i < length && i < 6; i++ {
|
|
||||||
if p1[i] != p2[i] {
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
if length == 4 {
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
return p1[4] == p2[4] && p1[5] == p2[5]
|
||||||
|
}
|
||||||
|
|
||||||
/* Builds a command and distance prefix code (each 64 symbols) into "depth" and
|
/* Builds a command and distance prefix code (each 64 symbols) into "depth" and
|
||||||
"bits" based on "histogram" and stores it into the bit stream. */
|
"bits" based on "histogram" and stores it into the bit stream. */
|
||||||
|
|
Loading…
Reference in New Issue