diff options
author | Mike Pall <mike> | 2011-02-27 01:31:22 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2011-02-27 01:31:22 +0100 |
commit | c031d4b6a06eab94e8d9b837ec6dc257899a4ae1 (patch) | |
tree | 785116fc10de78f3414604fcd9b403a0e63dfa0e /src/lj_clib.c | |
parent | d437086c5a82cb44ba34d039695aff79e7a1793c (diff) | |
download | luajit2-c031d4b6a06eab94e8d9b837ec6dc257899a4ae1.tar.gz |
DUALNUM: Handle integer type in FFI.
Diffstat (limited to 'src/lj_clib.c')
-rw-r--r-- | src/lj_clib.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lj_clib.c b/src/lj_clib.c index 98d74cde..d7721860 100644 --- a/src/lj_clib.c +++ b/src/lj_clib.c @@ -266,10 +266,10 @@ TValue *lj_clib_index(lua_State *L, CLibrary *cl, GCstr *name) if (ctype_isconstval(ct->info)) { CType *ctt = ctype_child(cts, ct); lua_assert(ctype_isinteger(ctt->info) && ctt->size <= 4); - if ((ctt->info & CTF_UNSIGNED) && ctt->size == 4) + if ((ctt->info & CTF_UNSIGNED) && (int32_t)ct->size < 0) setnumV(tv, (lua_Number)(uint32_t)ct->size); else - setnumV(tv, (lua_Number)(int32_t)ct->size); + setintV(tv, (int32_t)ct->size); } else { const char *sym = clib_extsym(cts, ct, name); void *p = clib_getsym(cl, sym); |