// Copyright 2016 The Gorilla WebSocket 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 !appengine
// +build !appengine

package websocket

import 

const wordSize = int(unsafe.Sizeof(uintptr(0)))

func maskBytes( [4]byte,  int,  []byte) int {
	// Mask one byte at a time for small buffers.
	if len() < 2*wordSize {
		for  := range  {
			[] ^= [&3]
			++
		}
		return  & 3
	}

	// Mask one byte at a time to word boundary.
	if  := int(uintptr(unsafe.Pointer(&[0]))) % wordSize;  != 0 {
		 = wordSize - 
		for  := range [:] {
			[] ^= [&3]
			++
		}
		 = [:]
	}

	// Create aligned word size key.
	var  [wordSize]byte
	for  := range  {
		[] = [(+)&3]
	}
	 := *(*uintptr)(unsafe.Pointer(&))

	// Mask one word at a time.
	 := (len() / wordSize) * wordSize
	for  := 0;  < ;  += wordSize {
		*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&[0])) + uintptr())) ^= 
	}

	// Mask one byte at a time for remaining bytes.
	 = [:]
	for  := range  {
		[] ^= [&3]
		++
	}

	return  & 3
}