lua-users home
lua-l archive

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


Any solution to this problem must change the way Lua hashes non-integer
numbers. One particular solution is this:


I seem to recall that the string hashing function takes the length of string to hash so how about just hashing non-integer numbers like this (sorry for not looking up the actual routines, but you get the idea):

hash_of_nonint = string_hash((char *)&number, sizeof(number));

Not even all that ugly if you think of string_hash as more of a memory_block_hash function.

Hashing to the integer parts does seem amazingly poor in corner cases.

Russ