diff options
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) | |||
266 | if (ctype_isconstval(ct->info)) { | 266 | if (ctype_isconstval(ct->info)) { |
267 | CType *ctt = ctype_child(cts, ct); | 267 | CType *ctt = ctype_child(cts, ct); |
268 | lua_assert(ctype_isinteger(ctt->info) && ctt->size <= 4); | 268 | lua_assert(ctype_isinteger(ctt->info) && ctt->size <= 4); |
269 | if ((ctt->info & CTF_UNSIGNED) && ctt->size == 4) | 269 | if ((ctt->info & CTF_UNSIGNED) && (int32_t)ct->size < 0) |
270 | setnumV(tv, (lua_Number)(uint32_t)ct->size); | 270 | setnumV(tv, (lua_Number)(uint32_t)ct->size); |
271 | else | 271 | else |
272 | setnumV(tv, (lua_Number)(int32_t)ct->size); | 272 | setintV(tv, (int32_t)ct->size); |
273 | } else { | 273 | } else { |
274 | const char *sym = clib_extsym(cts, ct, name); | 274 | const char *sym = clib_extsym(cts, ct, name); |
275 | void *p = clib_getsym(cl, sym); | 275 | void *p = clib_getsym(cl, sym); |