aboutsummaryrefslogtreecommitdiff
path: root/src/lj_carith.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lj_carith.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lj_carith.c b/src/lj_carith.c
index 8f644d83..b0f4c65a 100644
--- a/src/lj_carith.c
+++ b/src/lj_carith.c
@@ -35,11 +35,16 @@ static int carith_checkarg(lua_State *L, CTState *cts, CDArith *ca)
35 for (i = 0; i < 2; i++, o++) { 35 for (i = 0; i < 2; i++, o++) {
36 if (tviscdata(o)) { 36 if (tviscdata(o)) {
37 GCcdata *cd = cdataV(o); 37 GCcdata *cd = cdataV(o);
38 CType *ct = ctype_raw(cts, (CTypeID)cd->typeid); 38 CTypeID id = (CTypeID)cd->typeid;
39 CType *ct = ctype_raw(cts, id);
39 uint8_t *p = (uint8_t *)cdataptr(cd); 40 uint8_t *p = (uint8_t *)cdataptr(cd);
40 if (ctype_isptr(ct->info)) { 41 if (ctype_isptr(ct->info)) {
41 p = (uint8_t *)cdata_getptr(p, ct->size); 42 p = (uint8_t *)cdata_getptr(p, ct->size);
42 if (ctype_isref(ct->info)) ct = ctype_rawchild(cts, ct); 43 if (ctype_isref(ct->info)) ct = ctype_rawchild(cts, ct);
44 } else if (ctype_isfunc(ct->info)) {
45 p = (uint8_t *)*(void **)p;
46 ct = ctype_get(cts,
47 lj_ctype_intern(cts, CTINFO(CT_PTR, CTALIGN_PTR|id), CTSIZE_PTR));
43 } 48 }
44 ca->ct[i] = ct; 49 ca->ct[i] = ct;
45 ca->p[i] = p; 50 ca->p[i] = p;