[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: problem with string.format %d and very large integers
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Sat, 30 Jul 2011 15:05:26 -0300
> It uses information from the byte code header.
Attached is a program that reads this header.
-- list header contents of precompiled chunks
-- typical usage: lua header.lua < luac.out
function byte() return string.byte(io.read(1)) end
-- signature
s=io.read(4)
if s~="\027Lua" then error"stdin is not a Lua precompiled chunk" end
-- version
b=byte()
v=math.floor(b/16).."."..math.fmod(b,16)
io.write("Lua ",v,"\n")
v=tonumber(v)
if v<=5 then return end
-- format
b=byte()
io.write("format version ",b,"\n")
-- endianness
b=byte()
if b==1 then io.write"little endian\n" else io.write"big endian\n" end
-- vm spec
io.write(byte(),"-byte integers\n")
io.write(byte(),"-byte size_t\n")
io.write(byte(),"-byte Instructions\n")
io.write(byte(),"-byte ")
if byte()==0 then io.write("reals\n") else io.write("integers\n") end
- References:
- Re: problem with string.format %d and very large integers, Luiz Henrique de Figueiredo
- Re: problem with string.format %d and very large integers, Lorenzo Donati
- Re: problem with string.format %d and very large integers, KHMan
- Re: problem with string.format %d and very large integers, Lorenzo Donati
- Re: problem with string.format %d and very large integers, Roberto Ierusalimschy
- Re: problem with string.format %d and very large integers, Lorenzo Donati
- Re: problem with string.format %d and very large integers, Lorenzo Donati
- Re: problem with string.format %d and very large integers, liam mail
- Re: problem with string.format %d and very large integers, Lorenzo Donati
- Re: problem with string.format %d and very large integers, liam mail