Expand Fletcher-16 NMAX

The limit when calculating the value of NMAX is 2^16-1 only when sum1
and sum2 are represented as 16-bit. We're representing them as 32-bit.

This will be helpful for SIMD implementations of Fletcher-16, because
the old limit of 22 bytes would have meant that we could only process
16 bytes at a time before having to compute modulo.
This commit is contained in:
JosJuice
2023-09-23 23:01:17 +02:00
committed by Natalia Portillo
parent 449c25012d
commit a9b6c4868b
3 changed files with 10 additions and 30 deletions

View File

@@ -20,7 +20,7 @@
#define AARU_CHECKSUMS_NATIVE_FLETCHER32_H
#define FLETCHER32_MODULE 0xFFFF
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(ADLER_MODULE-1) <= 2^32-1 */
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(FLETCHER32_MODULE-1) <= 2^32-1 */
#define NMAX 5552
typedef struct