lua-users home
lua-l archive

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


>> It is there because 'luaH_realasize' can be a little expensive to
>> compute, so the redundancy avoids that call in a quite common case.

> Wouldn't it be better to use a more efficient test such as the
> following instead?  [...]

> This test does some bit hacks to test that key-1 is smaller than the
> next power of two of the limit.

I haven't read the code enough to be sure, but, doesn't that amount to
assuming that realasize is a power of two?  If so, it's brittle in that
it puts that knowledge somewhere it doesn't belong.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse@rodents-montreal.org
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B