[fpc-devel] Unexpected behaviour of bit operators

Marco Borsari borsa77 at libero.it
Fri May 17 17:23:33 CEST 2019


On Fri, 17 May 2019 16:45:52 +0200
gabor <gabor at poczta.onet.pl> wrote:

> Can you provide c source code?
> I'm not sure about this:
> ...(a SHL 5+b SHR 2)...
> Maybe it should look like this:
> ((a SHL 5+b) SHR 2)
> 
> Regards, MichaƂ.

Please look at

https://burtleburtle.net/bob/hash/doobs.html

for the Rotating Hash, it is 32 bit but I remember there is the 16
bit version even. Correct implementation is the sum (xoring) of
two shifted value (be careful that my hash it is intended for
string of length 2).

-- 
Simplex sigillum veri



More information about the fpc-devel mailing list