gitee.com/ks-custle/core-gm@v0.0.0-20230922171213-b83bdd97b62c/internal/xor/xor_arm64.go (about) 1 // Copyright 2018 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package xor 6 7 // xorBytes xors the bytes in a and b. The destination should have enough 8 // space, otherwise xorBytes will panic. Returns the number of bytes xor'd. 9 func XorBytes(dst, a, b []byte) int { 10 n := len(a) 11 if len(b) < n { 12 n = len(b) 13 } 14 if n == 0 { 15 return 0 16 } 17 // make sure dst has enough space 18 _ = dst[n-1] 19 20 xorBytesARM64(&dst[0], &a[0], &b[0], n) 21 return n 22 } 23 24 func XorWords(dst, a, b []byte) { 25 XorBytes(dst, a, b) 26 } 27 28 //go:noescape 29 func xorBytesARM64(dst, a, b *byte, n int)