commit 3f2f5681dc5120355c14c2389a9be6be6f5b1355
parent d52d93206950864179a0da2c44b5dd0528506213
Author: sin <sin@2f30.org>
Date: Sat, 2 Mar 2019 13:19:32 +0000
Rename winsize to size
Make it a bit more generic.
Diffstat:
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/chunker.c b/chunker.c
@@ -63,21 +63,21 @@ static uint32_t buz[] = {
/* Buzhash: https://en.wikipedia.org/wiki/Rolling_hash#Cyclic_polynomial */
static inline uint32_t
-buzh_init(uint8_t *buf, size_t winsize)
+buzh_init(uint8_t *buf, size_t size)
{
uint32_t fp;
size_t i;
- for (i = 1, fp = 0; i < winsize; i++, buf++)
- fp ^= ROTL(buz[*buf], (winsize - i) % 32);
+ for (i = 1, fp = 0; i < size; i++, buf++)
+ fp ^= ROTL(buz[*buf], (size - i) % 32);
return fp ^ buz[*buf];
}
static inline uint32_t
-buzh_update(uint32_t fp, uint8_t out, uint8_t in, size_t winsize)
+buzh_update(uint32_t fp, uint8_t out, uint8_t in, size_t size)
{
- return ROTL(fp, 1) ^ ROTL(buz[out], winsize % 32) ^ buz[in];
+ return ROTL(fp, 1) ^ ROTL(buz[out], size % 32) ^ buz[in];
}
static inline int