http: websocket: avoid modulo for power of 2

even for the small cases this can matter

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2022-02-04 17:12:05 +01:00
parent c70d98c90c
commit 42b6f4331f

View File

@ -114,7 +114,7 @@ fn mask_bytes(mask: Option<[u8; 4]>, data: &mut [u8]) {
if data.len() < 32 {
for i in 0..data.len() {
data[i] ^= mask[i % 4];
data[i] ^= mask[i & 3];
}
return;
}