Source File
mask.go
Belonging Package
github.com/gorilla/websocket
// 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 !appenginepackage websocketimportconst 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]bytefor := range {[] = [(+)&3]}:= *(*uintptr)(unsafe.Pointer(&))// Mask one word at a time.:= (len() / wordSize) * wordSizefor := 0; < ; += wordSize {*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&[0])) + uintptr())) ^=}// Mask one byte at a time for remaining bytes.= [:]for := range {[] ^= [&3]++}return & 3}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux 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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |