1 //go:build amd64 || arm64
2 3 package websocket
4 5 func mask(b []byte, key uint32) uint32 {
6 // TODO: Will enable in v1.9.0.
7 return maskGo(b, key)
8 /*
9 if len(b) > 0 {
10 return maskAsm(&b[0], len(b), key)
11 }
12 return key
13 */
14 }
15 16 // @nhooyr: I am not confident that the amd64 or the arm64 implementations of this
17 // function are perfect. There are almost certainly missing optimizations or
18 // opportunities for simplification. I'm confident there are no bugs though.
19 // For example, the arm64 implementation doesn't align memory like the amd64.
20 // Or the amd64 implementation could use AVX512 instead of just AVX2.
21 // The AVX2 code I had to disable anyway as it wasn't performing as expected.
22 // See https://github.com/nhooyr/websocket/pull/326#issuecomment-1771138049
23 //
24 //go:noescape
25 //lint:ignore U1000 disabled till v1.9.0
26 func maskAsm(b *byte, len int, key uint32) uint32
27