Skip to content

Commit

Permalink
No need to reload the mask if we can extract it from the SSE path
Browse files Browse the repository at this point in the history
  • Loading branch information
lpereira committed Apr 28, 2024
1 parent dc350c7 commit f3e4036
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib/lwan-websocket.c
Expand Up @@ -213,7 +213,11 @@ static void unmask(char *msg, size_t msg_len, char mask[static 4])
}

if (msg_len >= 4) {
#if defined(__SSE_4_1__)
const uint32_t mask32 = _mm_extract_epi32(mask128, 0);
#else
const uint32_t mask32 = string_as_uint32(mask);
#endif
do {
uint32_t v = string_as_uint32(msg);
v ^= (uint32_t)mask32;
Expand Down

0 comments on commit f3e4036

Please sign in to comment.