Source File
xor_unaligned.go
Belonging Package
mellium.im/sasl
// 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.// This file was split out from Go's crypto/cipher/xor.go// +build 386 amd64 ppc64 ppc64le s390x appenginepackage saslimport ()const wordSize = int(unsafe.Sizeof(uintptr(0)))// xorBytes xors in bulk. It only works on architectures that support unaligned// read/writes.func (, , []byte) int {:= len()if len() < {= len()}:= / wordSizeif > 0 {:= *(*[]uintptr)(unsafe.Pointer(&)):= *(*[]uintptr)(unsafe.Pointer(&)):= *(*[]uintptr)(unsafe.Pointer(&))for := 0; < ; ++ {[] = [] ^ []}}for := ( - %wordSize); < ; ++ {[] = [] ^ []}return}// xorWords XORs multiples of 4 or 8 bytes (depending on architecture.) The// arguments are assumed to be of equal length.func (, , []byte) {:= *(*[]uintptr)(unsafe.Pointer(&)):= *(*[]uintptr)(unsafe.Pointer(&)):= *(*[]uintptr)(unsafe.Pointer(&)):= len() / wordSizefor := 0; < ; ++ {[] = [] ^ []}}
![]() |
The pages are generated with Golds v0.3.6. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |