aboutsummaryrefslogtreecommitdiff
path: root/testes
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-03-19 15:31:08 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-03-19 15:31:08 -0300
commitf53eabeed855081fa38e9af5cf7c977915f5213f (patch)
tree1e116377bb3666a36f76220a22e9149549b31975 /testes
parent39bb3cf2422603d854ee12529cc3419dc735802a (diff)
downloadlua-f53eabeed855081fa38e9af5cf7c977915f5213f.tar.gz
lua-f53eabeed855081fa38e9af5cf7c977915f5213f.tar.bz2
lua-f53eabeed855081fa38e9af5cf7c977915f5213f.zip
Small changes in the header of binary files
- LUAC_VERSION is equal to LUA_VERSION_NUM, and it is stored as an int. - 'sizeof(int)' and 'sizeof(size_t)' removed from the header, as the binary format does not depend on these sizes. (It uses its own serialization for unsigned integer values.)
Diffstat (limited to 'testes')
-rw-r--r--testes/calls.lua20
1 files changed, 9 insertions, 11 deletions
diff --git a/testes/calls.lua b/testes/calls.lua
index f5108a47..941493b1 100644
--- a/testes/calls.lua
+++ b/testes/calls.lua
@@ -397,17 +397,15 @@ assert((function (a) return a end)() == nil)
397 397
398print("testing binary chunks") 398print("testing binary chunks")
399do 399do
400 local header = string.pack("c4BBc6BBBBBj", 400 local header = string.pack("c4BBBc6BBBj",
401 "\27Lua", -- signature 401 "\27Lua", -- signature
402 5*16 + 4, -- version 5.4 402 (504 >> 7) & 0x7f, (504 & 0x7f) | 0x80, -- version 5.4 (504)
403 0, -- format 403 0, -- format
404 "\x19\x93\r\n\x1a\n", -- data 404 "\x19\x93\r\n\x1a\n", -- data
405 string.packsize("i"), -- sizeof(int) 405 4, -- size of instruction
406 string.packsize("T"), -- sizeof(size_t) 406 string.packsize("j"), -- sizeof(lua integer)
407 4, -- size of instruction 407 string.packsize("n"), -- sizeof(lua number)
408 string.packsize("j"), -- sizeof(lua integer) 408 0x5678 -- LUAC_INT
409 string.packsize("n"), -- sizeof(lua number)
410 0x5678 -- LUAC_INT
411 -- LUAC_NUM may not have a unique binary representation (padding...) 409 -- LUAC_NUM may not have a unique binary representation (padding...)
412 ) 410 )
413 local c = string.dump(function () local a = 1; local b = 3; return a+b*3 end) 411 local c = string.dump(function () local a = 1; local b = 3; return a+b*3 end)