Skip to content

Commit 8ca19c5

Browse files
author
benpop
committed
test whether main types are at least 64 bits
1 parent 4d726e6 commit 8ca19c5

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

int64.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,34 @@ static void *luaL_testudata (lua_State *L, int ud, const char *tname) {
148148
/* }================================================================= */
149149

150150

151+
/*
152+
** {=================================================================
153+
** Test whether types are at least 64 bits wide.
154+
** ==================================================================
155+
*/
156+
157+
158+
LUALIB_API int luaL_integeris64 (lua_State *L) {
159+
(void)L;
160+
return LUA_INTEGER_64;
161+
}
162+
163+
164+
LUALIB_API int luaL_numberis64 (lua_State *L) {
165+
(void)L;
166+
return LUA_NUMBER_64;
167+
}
168+
169+
170+
LUALIB_API int luaL_pointeris64 (lua_State *L) {
171+
(void)L;
172+
return LUA_POINTER_64;
173+
}
174+
175+
176+
/* }================================================================= */
177+
178+
151179
/*
152180
** {=================================================================
153181
** Lua type => (u)int64_t

int64.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ LUALIB_API void luaL_u64pushstring (lua_State *L, uint64_t n);
5555
LUALIB_API void luaL_i64pushhex (lua_State *L, int64_t n);
5656
LUALIB_API void luaL_u64pushhex (lua_State *L, uint64_t n);
5757

58+
/*
59+
** {=================================================================
60+
** Test whether types are at least 64 bits wide.
61+
** ==================================================================
62+
*/
63+
LUALIB_API int luaL_integeris64 (lua_State *L);
64+
LUALIB_API int luaL_numberis64 (lua_State *L);
65+
LUALIB_API int luaL_pointeris64 (lua_State *L);
66+
67+
/* }================================================================= */
68+
5869
/*
5970
** {=================================================================
6071
** This is incredibly hacky and may not even work.

0 commit comments

Comments
 (0)