lua-users home
lua-l archive

Re: question on hash for objects such as tables and functions

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Philippe:
On Tue, May 26, 2020 at 11:30 PM Philippe Verdy <verdyp@gmail.com> wrote:
> So now you can confirm that the factor 129 is not suitable as is is not prime (divisible by 3) even if it's a Mersenne number (=2^7+1).
To be strict, Mersenne numbers are -1, that +1 is an extension you
have put without proof.
Anyway, what can I confirm 129 is not suitable for?
> But the current implementation still uses it as the factor: (h<<5)+(h>>2) is the same as (h<<7 + h)>>>2 = (h*128+h)>>>2 = (h*129)>>>2; this way of writing it with the sum of shifts in two directions avoids discarding 2 high bits with (h<<7)
So, you affirm it is the same only to prove it is not the same in the
same sentence?
...
> Knuth designated good multipliers for several wordsizes. You deliberately ignored it just like you deliberately chose to ignore the primality requiement of the factor: this is a proof that you've not understood the Knuth algorithm and how and why it really works as a good (but still fast) hash.
.... This "you deliberately" seems to indicate you are not replying to
me, although you are doing it in ( top posted as usual, something
smells rotten in Denmark ) response which quotes me.
> So in this piece of code,
Yep, you are totally loosing direction. No piece of code, no context.
I think this should be addressed to the PUC people or some other real
implementer. Cutting it short now.
FOS.

AltStyle によって変換されたページ (->オリジナル) /