Re: jff: checksum algorithm is not as intended

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)ru>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: jff: checksum algorithm is not as intended
Date: 2021-08-30 04:21:44
Message-ID: 1306071.1630297304@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)ru> writes:
> Single round function is written as:

> #define CHECKSUM_COMP(checksum, value) do {\
> uint32 __tmp = (checksum) ^ (value);\
> (checksum) = __tmp * FNV_PRIME ^ (__tmp >> 17);\
> } while (0)

> And looks like it was intended to be
> (checksum) = (__tmp * FNV_PRIME) ^ (__tmp >> 17);

I'm not following your point? Multiplication binds tighter than XOR
in C, see e.g.

https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Operator_precedence

So those sure look equivalent from here.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2021-08-30 04:36:12 Re: simplifying foreign key/RI checks
Previous Message houzj.fnst@fujitsu.com 2021-08-30 03:40:10 RE: Added schema level support for publication.