mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 15:14:08 +00:00
FFI: Fix ffi.alignof() for reference types.
Reported by Eric Gouyer.
This commit is contained in:
parent
27a6fee82e
commit
36b2962d40
@ -615,7 +615,7 @@ LJLIB_CF(ffi_alignof) LJLIB_REC(ffi_xof FF_ffi_alignof)
|
||||
CTState *cts = ctype_cts(L);
|
||||
CTypeID id = ffi_checkctype(L, cts, NULL);
|
||||
CTSize sz = 0;
|
||||
CTInfo info = lj_ctype_info(cts, id, &sz);
|
||||
CTInfo info = lj_ctype_info_raw(cts, id, &sz);
|
||||
setintV(L->top-1, 1 << ctype_align(info));
|
||||
return 1;
|
||||
}
|
||||
|
@ -328,6 +328,14 @@ CTInfo lj_ctype_info(CTState *cts, CTypeID id, CTSize *szp)
|
||||
return qual;
|
||||
}
|
||||
|
||||
/* Ditto, but follow a reference. */
|
||||
CTInfo lj_ctype_info_raw(CTState *cts, CTypeID id, CTSize *szp)
|
||||
{
|
||||
CType *ct = ctype_get(cts, id);
|
||||
if (ctype_isref(ct->info)) id = ctype_cid(ct->info);
|
||||
return lj_ctype_info(cts, id, szp);
|
||||
}
|
||||
|
||||
/* Get ctype metamethod. */
|
||||
cTValue *lj_ctype_meta(CTState *cts, CTypeID id, MMS mm)
|
||||
{
|
||||
|
@ -449,6 +449,7 @@ LJ_FUNC CType *lj_ctype_rawref(CTState *cts, CTypeID id);
|
||||
LJ_FUNC CTSize lj_ctype_size(CTState *cts, CTypeID id);
|
||||
LJ_FUNC CTSize lj_ctype_vlsize(CTState *cts, CType *ct, CTSize nelem);
|
||||
LJ_FUNC CTInfo lj_ctype_info(CTState *cts, CTypeID id, CTSize *szp);
|
||||
LJ_FUNC CTInfo lj_ctype_info_raw(CTState *cts, CTypeID id, CTSize *szp);
|
||||
LJ_FUNC cTValue *lj_ctype_meta(CTState *cts, CTypeID id, MMS mm);
|
||||
LJ_FUNC GCstr *lj_ctype_repr(lua_State *L, CTypeID id, GCstr *name);
|
||||
LJ_FUNC GCstr *lj_ctype_repr_int64(lua_State *L, uint64_t n, int isunsigned);
|
||||
|
Loading…
Reference in New Issue
Block a user