[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua 5.3 alignment issue
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 26 Jul 2019 10:02:16 -0300
> Digging into the Lua implementation I found that defining
> LUAI_USER_ALIGNMENT_T can override the standard alignment of the
> pointer returned by lua_newuserdata. Is this 'officially' supported?
Yes. It exists exactly to allow that kind of correction.
> It's not overly difficult to write code that works with an unmodified
> Lua interpreter, but shouldn't lua_newuserdata return pointers that
> can be used in the same way as 'malloc' generated pointers?
I don't think it is possible to implement that in a portalbe manner
in ANSI C, unless we have zero overhead. (For instance, in your case,
you have to know about a '__m128i' type.) That is why we have the macro