mirror of
https://github.com/rclone/rclone.git
synced 2024-12-02 05:14:55 +01:00
21 lines
299 B
Go
21 lines
299 B
Go
|
//go:build !go1.20
|
||
|
|
||
|
package quickxorhash
|
||
|
|
||
|
func xorBytes(dst, src []byte) int {
|
||
|
n := len(dst)
|
||
|
if len(src) < n {
|
||
|
n = len(src)
|
||
|
}
|
||
|
if n == 0 {
|
||
|
return 0
|
||
|
}
|
||
|
dst = dst[:n]
|
||
|
//src = src[:n]
|
||
|
src = src[:len(dst)] // remove bounds check in loop
|
||
|
for i := range dst {
|
||
|
dst[i] ^= src[i]
|
||
|
}
|
||
|
return n
|
||
|
}
|