refactor: use branchless handling for odd byte in checksum

This commit is contained in:
lohhiiccc 2026-03-05 10:05:26 +01:00
parent 69a6a633d4
commit 1434409738

View file

@ -42,8 +42,7 @@ sum_words(const uint8_t *data, size_t len)
} }
/* Handle odd byte if present */ /* Handle odd byte if present */
if (len & 1) sum += ((uint32_t)(*ptr << 8)) & -(len & 1);
sum += (uint32_t)(*ptr << 8);
return sum; return sum;
} }