From 8d12f0b8675d1f9df4e5d42883328b0d7fb3f1c8 Mon Sep 17 00:00:00 2001 From: bjorn Date: Mon, 11 Nov 2019 16:38:22 -0800 Subject: [PATCH] Make userdata hashes 64 bit; --- src/api/api.c | 6 +++--- src/api/api.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/api/api.c b/src/api/api.c index 3172de42..0e8c9ed0 100644 --- a/src/api/api.c +++ b/src/api/api.c @@ -74,7 +74,7 @@ void _luax_registertype(lua_State* L, const char* name, const luaL_Reg* function lua_pop(L, 1); } -void* _luax_totype(lua_State* L, int index, uint32_t hash) { +void* _luax_totype(lua_State* L, int index, uint64_t hash) { Proxy* p = lua_touserdata(L, index); if (p && lua_type(L, index) != LUA_TLIGHTUSERDATA && p->hash == hash) { @@ -84,7 +84,7 @@ void* _luax_totype(lua_State* L, int index, uint32_t hash) { return NULL; } -void* _luax_checktype(lua_State* L, int index, uint32_t hash, const char* debug) { +void* _luax_checktype(lua_State* L, int index, uint64_t hash, const char* debug) { void* object = _luax_totype(L, index, hash); if (!object) { @@ -95,7 +95,7 @@ void* _luax_checktype(lua_State* L, int index, uint32_t hash, const char* debug) } // Registers the userdata on the top of the stack in the registry. -void _luax_pushtype(lua_State* L, const char* type, uint32_t hash, void* object) { +void _luax_pushtype(lua_State* L, const char* type, uint64_t hash, void* object) { if (!object) { lua_pushnil(L); return; diff --git a/src/api/api.h b/src/api/api.h index d87c6bc2..bafb0e7d 100644 --- a/src/api/api.h +++ b/src/api/api.h @@ -119,9 +119,9 @@ typedef struct { #define luax_clearerror(L) lua_pushnil(L), luax_seterror(L) void _luax_registertype(lua_State* L, const char* name, const luaL_Reg* functions, void (*destructor)(void*)); -void* _luax_totype(lua_State* L, int index, uint32_t hash); -void* _luax_checktype(lua_State* L, int index, uint32_t hash, const char* debug); -void _luax_pushtype(lua_State* L, const char* name, uint32_t hash, void* object); +void* _luax_totype(lua_State* L, int index, uint64_t hash); +void* _luax_checktype(lua_State* L, int index, uint64_t hash, const char* debug); +void _luax_pushtype(lua_State* L, const char* name, uint64_t hash, void* object); void luax_registerloader(lua_State* L, lua_CFunction loader, int index); void luax_vthrow(void* L, const char* format, va_list args); void luax_traceback(lua_State* L, lua_State* T, const char* message, int level);