// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build (!amd64 && !arm64) || purego package bitutil import "unsafe" func orBytes(dst, a, b []byte) int { if supportsUnaligned { return fastORBytes(dst, a, b) } return safeORBytes(dst, a, b) } // fastORBytes ors in bulk. It only works on architectures that support // unaligned read/writes. func fastORBytes(dst, a, b []byte) int { n := len(a) if len(b) < n { n = len(b) } w := n / wordSize if w > 0 { dw := *(*[]uintptr)(unsafe.Pointer(&dst)) aw := *(*[]uintptr)(unsafe.Pointer(&a)) bw := *(*[]uintptr)(unsafe.Pointer(&b)) for i := 0; i < w; i++ { dw[i] = aw[i] | bw[i] } } for i := n - n%wordSize; i < n; i++ { dst[i] = a[i] | b[i] } return n }