lua

A copy of the Lua development repository
Log | Files | Refs | README

commit dc59444cd120e38d0babaeb3a7ad3d36f63225e6
parent 6c042e17b15f1381296a7ec1cd207741ade71170
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Tue, 19 Jun 2007 17:23:06 -0300

strong collision for very small numbers used as table keys

Diffstat:
Mbugs | 17+++++++++++++++++
1 file changed, 17 insertions(+), 0 deletions(-)

diff --git a/bugs b/bugs @@ -1476,6 +1476,23 @@ ldebug.c: } Bug{ +what = [[Very small numbers all collide in the hash function. +(This creates only performance problems; the behavoir is correct.)]], +report = [[, on ]], +since = [[Lua 5.0]], +example = [[ ]], +patch = [[ +ltable.c: +87,88c87,88 +< n += 1; /* normalize number (avoid -0) */ +< lua_assert(sizeof(a) <= sizeof(n)); +--- +> if (luai_numeq(n, 0)) /* avoid problems with -0 */ +> return gnode(t, 0); +]], +} + +Bug{ what = [[ ]], report = [[ , on ]], since = [[i ]],