aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2024-04-29 09:17:07 +0200
committerBenoit Germain <benoit.germain@ubisoft.com>2024-04-29 09:17:07 +0200
commit80672df530bff762047134c58c061e83ba082487 (patch)
treec18b977c62b98ac154d67927a0d2e8bc56fe5358 /src
parent28c7e6b487242f76cc4a945cc462612f90caee7e (diff)
downloadlanes-3.17.0.tar.gz
lanes-3.17.0.tar.bz2
lanes-3.17.0.zip
remove uintptr_t againv3.17.0
Diffstat (limited to 'src')
-rw-r--r--src/deep.c4
-rw-r--r--src/keeper.c8
-rw-r--r--src/keeper.h6
-rw-r--r--src/linda.c10
-rw-r--r--src/uniquekey.h4
5 files changed, 16 insertions, 16 deletions
diff --git a/src/deep.c b/src/deep.c
index a1f078a..f3e6fd3 100644
--- a/src/deep.c
+++ b/src/deep.c
@@ -236,7 +236,7 @@ char const* push_deep_proxy( Universe* U, lua_State* L, DeepPrelude* prelude, in
236 *proxy = prelude; 236 *proxy = prelude;
237 237
238 // Get/create metatable for 'idfunc' (in this state) 238 // Get/create metatable for 'idfunc' (in this state)
239 lua_pushlightuserdata( L, (void*)(uintptr_t)(prelude->idfunc)); // DPC proxy idfunc 239 lua_pushlightuserdata(L, (void*) prelude->idfunc); // DPC proxy idfunc
240 get_deep_lookup( L); // DPC proxy metatable? 240 get_deep_lookup( L); // DPC proxy metatable?
241 241
242 if( lua_isnil( L, -1)) // // No metatable yet. 242 if( lua_isnil( L, -1)) // // No metatable yet.
@@ -278,7 +278,7 @@ char const* push_deep_proxy( Universe* U, lua_State* L, DeepPrelude* prelude, in
278 278
279 // Memorize for later rounds 279 // Memorize for later rounds
280 lua_pushvalue( L, -1); // DPC proxy metatable metatable 280 lua_pushvalue( L, -1); // DPC proxy metatable metatable
281 lua_pushlightuserdata( L, (void*)(uintptr_t)(prelude->idfunc)); // DPC proxy metatable metatable idfunc 281 lua_pushlightuserdata(L, (void*) prelude->idfunc); // DPC proxy metatable metatable idfunc
282 set_deep_lookup( L); // DPC proxy metatable 282 set_deep_lookup( L); // DPC proxy metatable
283 283
284 // 2 - cause the target state to require the module that exported the idfunc 284 // 2 - cause the target state to require the module that exported the idfunc
diff --git a/src/keeper.c b/src/keeper.c
index 1522718..2a966ef 100644
--- a/src/keeper.c
+++ b/src/keeper.c
@@ -189,7 +189,7 @@ static void push_table( lua_State* L, int idx_)
189 STACK_END( L, 1); 189 STACK_END( L, 1);
190} 190}
191 191
192int keeper_push_linda_storage( Universe* U, lua_State* L, void* ptr_, uintptr_t magic_) 192int keeper_push_linda_storage(Universe* U, lua_State* L, void* ptr_, uint_t magic_)
193{ 193{
194 Keeper* const K = which_keeper( U->keepers, magic_); 194 Keeper* const K = which_keeper( U->keepers, magic_);
195 lua_State* const KL = K ? K->L : NULL; 195 lua_State* const KL = K ? K->L : NULL;
@@ -731,7 +731,7 @@ void init_keepers( Universe* U, lua_State* L)
731} 731}
732 732
733// should be called only when inside a keeper_acquire/keeper_release pair (see linda_protected_call) 733// should be called only when inside a keeper_acquire/keeper_release pair (see linda_protected_call)
734Keeper* which_keeper(Keepers* keepers_, uintptr_t magic_) 734Keeper* which_keeper(Keepers* keepers_, uint_t magic_)
735{ 735{
736 int const nbKeepers = keepers_->nb_keepers; 736 int const nbKeepers = keepers_->nb_keepers;
737 if (nbKeepers) 737 if (nbKeepers)
@@ -742,7 +742,7 @@ Keeper* which_keeper(Keepers* keepers_, uintptr_t magic_)
742 return NULL; 742 return NULL;
743} 743}
744 744
745Keeper* keeper_acquire( Keepers* keepers_, uintptr_t magic_) 745Keeper* keeper_acquire(Keepers* keepers_, uint_t magic_)
746{ 746{
747 int const nbKeepers = keepers_->nb_keepers; 747 int const nbKeepers = keepers_->nb_keepers;
748 // can be 0 if this happens during main state shutdown (lanes is being GC'ed -> no keepers) 748 // can be 0 if this happens during main state shutdown (lanes is being GC'ed -> no keepers)
@@ -755,7 +755,7 @@ Keeper* keeper_acquire( Keepers* keepers_, uintptr_t magic_)
755 * Pointers are often aligned by 8 or so - ignore the low order bits 755 * Pointers are often aligned by 8 or so - ignore the low order bits
756 * have to cast to unsigned long to avoid compilation warnings about loss of data when converting pointer-to-integer 756 * have to cast to unsigned long to avoid compilation warnings about loss of data when converting pointer-to-integer
757 */ 757 */
758 unsigned int i = (unsigned int)((magic_ >> KEEPER_MAGIC_SHIFT) % nbKeepers); 758 uint_t i = (uint_t) ((magic_ >> KEEPER_MAGIC_SHIFT) % nbKeepers);
759 Keeper* K = &keepers_->keeper_array[i]; 759 Keeper* K = &keepers_->keeper_array[i];
760 760
761 MUTEX_LOCK( &K->keeper_cs); 761 MUTEX_LOCK( &K->keeper_cs);
diff --git a/src/keeper.h b/src/keeper.h
index 7c55809..7e3bde8 100644
--- a/src/keeper.h
+++ b/src/keeper.h
@@ -30,12 +30,12 @@ typedef struct s_Keepers Keepers;
30void init_keepers( Universe* U, lua_State* L); 30void init_keepers( Universe* U, lua_State* L);
31void close_keepers( Universe* U); 31void close_keepers( Universe* U);
32 32
33Keeper* which_keeper( Keepers* keepers_, uintptr_t magic_); 33Keeper* which_keeper(Keepers* keepers_, uint_t magic_);
34Keeper* keeper_acquire( Keepers* keepers_, uintptr_t magic_); 34Keeper* keeper_acquire(Keepers* keepers_, uint_t magic_);
35#define KEEPER_MAGIC_SHIFT 3 35#define KEEPER_MAGIC_SHIFT 3
36void keeper_release( Keeper* K_); 36void keeper_release( Keeper* K_);
37void keeper_toggle_nil_sentinels( lua_State* L, int val_i_, LookupMode const mode_); 37void keeper_toggle_nil_sentinels( lua_State* L, int val_i_, LookupMode const mode_);
38int keeper_push_linda_storage( Universe* U, lua_State* L, void* ptr_, uintptr_t magic_); 38int keeper_push_linda_storage(Universe* U, lua_State* L, void* ptr_, uint_t magic_);
39 39
40// crc64/we of string "NIL_SENTINEL" generated at http://www.nitrxgen.net/hashgen/ 40// crc64/we of string "NIL_SENTINEL" generated at http://www.nitrxgen.net/hashgen/
41static DECLARE_CONST_UNIQUE_KEY( NIL_SENTINEL, 0x7eaafa003a1d11a1); 41static DECLARE_CONST_UNIQUE_KEY( NIL_SENTINEL, 0x7eaafa003a1d11a1);
diff --git a/src/linda.c b/src/linda.c
index d92f5f2..3e189f2 100644
--- a/src/linda.c
+++ b/src/linda.c
@@ -52,11 +52,11 @@ struct s_Linda
52 SIGNAL_T read_happened; 52 SIGNAL_T read_happened;
53 SIGNAL_T write_happened; 53 SIGNAL_T write_happened;
54 Universe* U; // the universe this linda belongs to 54 Universe* U; // the universe this linda belongs to
55 uintptr_t group; // a group to control keeper allocation between lindas 55 uint_t group; // a group to control keeper allocation between lindas
56 enum e_cancel_request simulate_cancel; 56 enum e_cancel_request simulate_cancel;
57 char name[1]; 57 char name[1];
58}; 58};
59#define LINDA_KEEPER_HASHSEED( linda) (linda->group ? linda->group : (uintptr_t)linda) 59#define LINDA_KEEPER_HASHSEED(linda) (linda->group ? linda->group : (uint_t)(ptrdiff_t) linda)
60 60
61static void* linda_id( lua_State*, DeepOp); 61static void* linda_id( lua_State*, DeepOp);
62 62
@@ -766,7 +766,7 @@ static void* linda_id( lua_State* L, DeepOp op_)
766 struct s_Linda* s; 766 struct s_Linda* s;
767 size_t name_len = 0; 767 size_t name_len = 0;
768 char const* linda_name = NULL; 768 char const* linda_name = NULL;
769 unsigned long linda_group = 0; 769 uint_t linda_group = 0;
770 // should have a string and/or a number of the stack as parameters (name and group) 770 // should have a string and/or a number of the stack as parameters (name and group)
771 switch( lua_gettop( L)) 771 switch( lua_gettop( L))
772 { 772 {
@@ -780,13 +780,13 @@ static void* linda_id( lua_State* L, DeepOp op_)
780 } 780 }
781 else 781 else
782 { 782 {
783 linda_group = (unsigned long) lua_tointeger( L, -1); 783 linda_group = (uint_t) lua_tointeger(L, -1);
784 } 784 }
785 break; 785 break;
786 786
787 case 2: // 2 parameters, a name and group, in that order 787 case 2: // 2 parameters, a name and group, in that order
788 linda_name = lua_tolstring( L, -2, &name_len); 788 linda_name = lua_tolstring( L, -2, &name_len);
789 linda_group = (unsigned long) lua_tointeger( L, -1); 789 linda_group = (uint_t) lua_tointeger(L, -1);
790 break; 790 break;
791 } 791 }
792 792
diff --git a/src/uniquekey.h b/src/uniquekey.h
index 7162753..c6a24a2 100644
--- a/src/uniquekey.h
+++ b/src/uniquekey.h
@@ -11,9 +11,9 @@ struct s_UniqueKey
11typedef struct s_UniqueKey UniqueKey; 11typedef struct s_UniqueKey UniqueKey;
12 12
13#if LUAJIT_FLAVOR() == 64 // building against LuaJIT headers for 64 bits, light userdata is restricted to 47 significant bits, because LuaJIT uses the other bits for internal optimizations 13#if LUAJIT_FLAVOR() == 64 // building against LuaJIT headers for 64 bits, light userdata is restricted to 47 significant bits, because LuaJIT uses the other bits for internal optimizations
14#define MAKE_UNIQUE_KEY( p_) ((void*)((uintptr_t)(p_) & 0x7fffffffffffull)) 14#define MAKE_UNIQUE_KEY(p_) ((void*) ((ptrdiff_t) (p_) &0x7fffffffffffull))
15#else // LUAJIT_FLAVOR() 15#else // LUAJIT_FLAVOR()
16#define MAKE_UNIQUE_KEY( p_) ((void*)(uintptr_t)(p_)) 16#define MAKE_UNIQUE_KEY(p_) ((void*) (ptrdiff_t) (p_))
17#endif // LUAJIT_FLAVOR() 17#endif // LUAJIT_FLAVOR()
18 18
19#define DECLARE_UNIQUE_KEY( name_) UniqueKey name_ 19#define DECLARE_UNIQUE_KEY( name_) UniqueKey name_