diff options
Diffstat (limited to 'src/uniquekey.h')
-rw-r--r-- | src/uniquekey.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/uniquekey.h b/src/uniquekey.h index 777d640..93aaf37 100644 --- a/src/uniquekey.h +++ b/src/uniquekey.h | |||
@@ -3,6 +3,8 @@ | |||
3 | #include "compat.h" | 3 | #include "compat.h" |
4 | #include "macros_and_utils.h" | 4 | #include "macros_and_utils.h" |
5 | 5 | ||
6 | #include <bit> | ||
7 | |||
6 | class UniqueKey | 8 | class UniqueKey |
7 | { | 9 | { |
8 | private: | 10 | private: |
@@ -31,13 +33,11 @@ class UniqueKey | |||
31 | 33 | ||
32 | void push(lua_State* const L) const | 34 | void push(lua_State* const L) const |
33 | { | 35 | { |
34 | // unfortunately, converting a scalar to a pointer must go through a C cast | 36 | lua_pushlightuserdata(L, std::bit_cast<void*>(m_storage)); |
35 | lua_pushlightuserdata(L, (void*) m_storage); | ||
36 | } | 37 | } |
37 | bool equals(lua_State* const L, int i) const | 38 | bool equals(lua_State* const L, int i) const |
38 | { | 39 | { |
39 | // unfortunately, converting a scalar to a pointer must go through a C cast | 40 | return lua_touserdata(L, i) == std::bit_cast<void*>(m_storage); |
40 | return lua_touserdata(L, i) == (void*) m_storage; | ||
41 | } | 41 | } |
42 | void query_registry(lua_State* const L) const | 42 | void query_registry(lua_State* const L) const |
43 | { | 43 | { |