[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua5 / poor performance
- From: "Russell Y. Webb" <rw20@...>
- Date: Fri, 21 Mar 2003 08:55:33 -0800
So IEEE floats have some duplication in bit representation based on the
sign bit. Integers of course have a 1 to 1 representation. How about
just using this code to hash all numbers?
TObject *o;
lua_Number n_to_hash = o->value.n;
if(n_to_hash < 0){
n_to_hash = -n_to_hash;
}
HashMemory(&n_to_hash, sizeof(n_to_hash));
Seems to handle all sensible number types and only causes automatic
collisions of pairs of numbers with the same absolute value (rather
than a myriad of numbers all having the same integer part).
Russ