[Scummvm-git-logs] scummvm master -> 94463b3ae73b14bc4ab6becb14507d40fa7d5252
aquadran
noreply at scummvm.org
Thu Jan 6 00:35:49 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
94463b3ae7 GRIM: Restore original signed type for hashing
Commit: 94463b3ae73b14bc4ab6becb14507d40fa7d5252
https://github.com/scummvm/scummvm/commit/94463b3ae73b14bc4ab6becb14507d40fa7d5252
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2022-01-06T01:35:43+01:00
Commit Message:
GRIM: Restore original signed type for hashing
Changed paths:
engines/grim/lua/ltable.cpp
diff --git a/engines/grim/lua/ltable.cpp b/engines/grim/lua/ltable.cpp
index 2df83a3c1a7..3ea0f7ce8cb 100644
--- a/engines/grim/lua/ltable.cpp
+++ b/engines/grim/lua/ltable.cpp
@@ -21,44 +21,44 @@ namespace Grim {
#define REHASH_LIMIT 0.70 // avoid more than this % full
#define TagDefault LUA_T_ARRAY;
-static uintptr hashindex(TObject *ref) {
- uintptr h;
+static intptr hashindex(TObject *ref) {
+ intptr h;
switch (ttype(ref)) {
case LUA_T_NUMBER:
- h = (uintptr)nvalue(ref);
+ h = (intptr)nvalue(ref);
break;
case LUA_T_USERDATA:
- h = (uintptr)ref->value.ud.id;
+ h = (intptr)ref->value.ud.id;
break;
case LUA_T_STRING:
- h = (uintptr)tsvalue(ref);
+ h = (intptr)tsvalue(ref);
break;
case LUA_T_ARRAY:
- h = (uintptr)avalue(ref);
+ h = (intptr)avalue(ref);
break;
case LUA_T_PROTO:
- h = (uintptr)tfvalue(ref);
+ h = (intptr)tfvalue(ref);
break;
case LUA_T_CPROTO:
- h = (uintptr)fvalue(ref);
+ h = (intptr)fvalue(ref);
break;
case LUA_T_CLOSURE:
- h = (uintptr)clvalue(ref);
+ h = (intptr)clvalue(ref);
break;
case LUA_T_TASK:
- h = (uintptr)nvalue(ref);
+ h = (intptr)nvalue(ref);
break;
default:
lua_error("unexpected type to index table");
h = 0; // to avoid warnings
}
- return h;
+ return (h >= 0 ? h : -(h + 1));
}
int32 present(Hash *t, TObject *key) {
int32 tsize = nhash(t);
- uintptr h = hashindex(key);
+ intptr h = hashindex(key);
int32 h1 = int32(h % tsize);
TObject *rf = ref(node(t, h1));
if (ttype(rf) != LUA_T_NIL && !luaO_equalObj(key, rf)) {
More information about the Scummvm-git-logs
mailing list