aboutsummaryrefslogtreecommitdiff
path: root/src/tools.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools.cpp')
-rw-r--r--src/tools.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/tools.cpp b/src/tools.cpp
index e6ebdba..ac2cf75 100644
--- a/src/tools.cpp
+++ b/src/tools.cpp
@@ -328,7 +328,7 @@ static lua_CFunction luaG_tocfunction( lua_State *L, int _i, FuncSubType *_out)
328} 328}
329 329
330// crc64/we of string "LOOKUPCACHE_REGKEY" generated at http://www.nitrxgen.net/hashgen/ 330// crc64/we of string "LOOKUPCACHE_REGKEY" generated at http://www.nitrxgen.net/hashgen/
331static DECLARE_CONST_UNIQUE_KEY( LOOKUPCACHE_REGKEY, 0x837a68dfc6fcb716); 331static constexpr UniqueKey LOOKUPCACHE_REGKEY{ 0x837a68dfc6fcb716ull };
332 332
333// inspired from tconcat() in ltablib.c 333// inspired from tconcat() in ltablib.c
334static char const* luaG_pushFQN( lua_State* L, int t, int last, size_t* length) 334static char const* luaG_pushFQN( lua_State* L, int t, int last, size_t* length)
@@ -627,7 +627,7 @@ void populate_func_lookup_table( lua_State* L, int _i, char const* name_)
627/*---=== Inter-state copying ===---*/ 627/*---=== Inter-state copying ===---*/
628 628
629// crc64/we of string "REG_MTID" generated at http://www.nitrxgen.net/hashgen/ 629// crc64/we of string "REG_MTID" generated at http://www.nitrxgen.net/hashgen/
630static DECLARE_CONST_UNIQUE_KEY( REG_MTID, 0x2e68f9b4751584dc); 630static constexpr UniqueKey REG_MTID{ 0x2e68f9b4751584dcull };
631 631
632/* 632/*
633* Get a unique ID for metatable at [i]. 633* Get a unique ID for metatable at [i].
@@ -845,7 +845,7 @@ static bool lookup_table( lua_State* L2, lua_State* L, uint_t i, LookupMode mode
845static bool push_cached_table( lua_State* L2, uint_t L2_cache_i, lua_State* L, uint_t i) 845static bool push_cached_table( lua_State* L2, uint_t L2_cache_i, lua_State* L, uint_t i)
846{ 846{
847 bool not_found_in_cache; // L2 847 bool not_found_in_cache; // L2
848 DECLARE_CONST_UNIQUE_KEY( p, lua_topointer( L, i)); 848 void const* p{ lua_topointer(L, i) };
849 849
850 ASSERT_L( L2_cache_i != 0); 850 ASSERT_L( L2_cache_i != 0);
851 STACK_GROW( L2, 3); 851 STACK_GROW( L2, 3);
@@ -854,7 +854,7 @@ static bool push_cached_table( lua_State* L2, uint_t L2_cache_i, lua_State* L, u
854 // We don't need to use the from state ('L') in ID since the life span 854 // We don't need to use the from state ('L') in ID since the life span
855 // is only for the duration of a copy (both states are locked). 855 // is only for the duration of a copy (both states are locked).
856 // push a light userdata uniquely representing the table 856 // push a light userdata uniquely representing the table
857 push_unique_key( L2, p); // ... p 857 lua_pushlightuserdata(L2, const_cast<void*>(p)); // ... p
858 858
859 //fprintf( stderr, "<< ID: %s >>\n", lua_tostring( L2, -1)); 859 //fprintf( stderr, "<< ID: %s >>\n", lua_tostring( L2, -1));
860 860
@@ -864,7 +864,7 @@ static bool push_cached_table( lua_State* L2, uint_t L2_cache_i, lua_State* L, u
864 { 864 {
865 lua_pop( L2, 1); // ... 865 lua_pop( L2, 1); // ...
866 lua_newtable( L2); // ... {} 866 lua_newtable( L2); // ... {}
867 push_unique_key( L2, p); // ... {} p 867 lua_pushlightuserdata(L2, const_cast<void*>(p)); // ... {} p
868 lua_pushvalue( L2, -2); // ... {} p {} 868 lua_pushvalue( L2, -2); // ... {} p {}
869 lua_rawset( L2, L2_cache_i); // ... {} 869 lua_rawset( L2, L2_cache_i); // ... {}
870 } 870 }
@@ -1508,7 +1508,7 @@ static void inter_copy_keyvaluepair( Universe* U, lua_State* L2, uint_t L2_cache
1508* The clone cache is a weak valued table listing all clones, indexed by their userdatapointer 1508* The clone cache is a weak valued table listing all clones, indexed by their userdatapointer
1509* fnv164 of string "CLONABLES_CACHE_KEY" generated at https://www.pelock.com/products/hash-calculator 1509* fnv164 of string "CLONABLES_CACHE_KEY" generated at https://www.pelock.com/products/hash-calculator
1510*/ 1510*/
1511static DECLARE_CONST_UNIQUE_KEY( CLONABLES_CACHE_KEY, 0xD04EE018B3DEE8F5); 1511static constexpr UniqueKey CLONABLES_CACHE_KEY{ 0xD04EE018B3DEE8F5ull };
1512 1512
1513static bool copyclone( Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State* L, uint_t source_i_, LookupMode mode_, char const* upName_) 1513static bool copyclone( Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State* L, uint_t source_i_, LookupMode mode_, char const* upName_)
1514{ 1514{