[luatex] fio library byte order
luigi scarso
luigi.scarso at gmail.com
Sat Jun 20 13:26:50 CEST 2020
On Fri, Jun 19, 2020 at 11:17 PM Reinhard Kotucha <reinhard.kotucha at web.de>
wrote:
> Hi,
> it's nice that with the fio library LuaTeX can now process binary
> files. What I'm missing is the ability to specify the byte order
> (little vs. big endian).
>
>
I don't knwo if it can help,
but if you can use ffi I think you can know the endianness of the current
platform with with this code:
\directlua{
ffi.cdef [[
union endianness {
int32_t i;
char c[4];
}
]]
local x = ffi.new('union endianness x',{i=1})
if(x.c[0]==1) then
print "little endian"
else
print "big endian"
end
}
\end
--
luigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/luatex/attachments/20200620/449439ee/attachment.html>
More information about the luatex
mailing list.