<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 19, 2020 at 11:17 PM Reinhard Kotucha <<a href="mailto:reinhard.kotucha@web.de">reinhard.kotucha@web.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
it's nice that with the fio library LuaTeX can now process binary<br>
files.  What I'm missing is the ability to specify the byte order<br>
(little vs. big endian).<br>
<br></blockquote></div><div><br></div><div>I don't knwo if it can help, </div>but if you can use ffi I think you can know the endianness of the current platform with with this code:<br clear="all"><div>\directlua{<br>ffi.cdef [[<br> union endianness {<br>   int32_t i;<br>   char c[4];<br> }<br>]]<br>local x = ffi.new('union endianness x',{i=1})<br>if(x.c[0]==1) then <br>  print "little endian"<br>else<br> print "big endian"<br>end<br>}<br>\end<br></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature">luigi<br></div></div>