lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> [...]
> 
> 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
LUAI_USER_ALIGNMENT_T.

-- Roberto