aboutsummaryrefslogtreecommitdiff
path: root/src/uniquekey.h
diff options
context:
space:
mode:
authorBenoit Germain <bnt.germain@gmail.com>2022-03-09 14:11:21 +0100
committerBenoit Germain <bnt.germain@gmail.com>2022-03-09 14:11:21 +0100
commit49ef9d50d475921aab0c50b13b857f8cb990fcc0 (patch)
tree0b5e4deefd63481e99557dd326352a4bb8cb5dc0 /src/uniquekey.h
parentfe44f7e83fc0b3264533caaa3085938d78c3750b (diff)
downloadlanes-49ef9d50d475921aab0c50b13b857f8cb990fcc0.tar.gz
lanes-49ef9d50d475921aab0c50b13b857f8cb990fcc0.tar.bz2
lanes-49ef9d50d475921aab0c50b13b857f8cb990fcc0.zip
moonjit support
Diffstat (limited to 'src/uniquekey.h')
-rw-r--r--src/uniquekey.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/uniquekey.h b/src/uniquekey.h
index a72426c..015fbf2 100644
--- a/src/uniquekey.h
+++ b/src/uniquekey.h
@@ -1,7 +1,7 @@
1#if !defined __LANES_UNIQUEKEY_H__ 1#if !defined __LANES_UNIQUEKEY_H__
2#define __LANES_UNIQUEKEY_H__ 1 2#define __LANES_UNIQUEKEY_H__ 1
3 3
4#include "macros_and_utils.h" 4#include "compat.h"
5 5
6// Lua light userdata can hold a pointer. 6// Lua light userdata can hold a pointer.
7struct s_UniqueKey 7struct s_UniqueKey
@@ -10,11 +10,11 @@ struct s_UniqueKey
10}; 10};
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*)((ptrdiff_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*)(ptrdiff_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_
20#define DECLARE_CONST_UNIQUE_KEY( name_, p_) UniqueKey const name_ = { MAKE_UNIQUE_KEY( p_)} 20#define DECLARE_CONST_UNIQUE_KEY( name_, p_) UniqueKey const name_ = { MAKE_UNIQUE_KEY( p_)}