aboutsummaryrefslogtreecommitdiff
path: root/lundump.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-02-12 15:16:11 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-02-12 15:16:11 -0300
commitc8121ce34b39c6fd31899f4da91e26063c8af54f (patch)
tree5ce96fbe65d5f16f87c816f88bab2df25975ba5d /lundump.h
parent7360f8d0fd91344deb583ff76b8250a1883dcd4c (diff)
downloadlua-c8121ce34b39c6fd31899f4da91e26063c8af54f.tar.gz
lua-c8121ce34b39c6fd31899f4da91e26063c8af54f.tar.bz2
lua-c8121ce34b39c6fd31899f4da91e26063c8af54f.zip
Revising code for Varint encoding in dumps
- Usign lua_Unsigned to count strings. - Varint uses a type large enough both for size_t and lua_Unsigned. - Most-Significant Bit 0 means last byte, to conform to common usage. - (unrelated) Change in macro 'getaddr' so that multiplication is by constants.
Diffstat (limited to 'lundump.h')
-rw-r--r--lundump.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/lundump.h b/lundump.h
index b10307e4..ff66d2e7 100644
--- a/lundump.h
+++ b/lundump.h
@@ -7,6 +7,8 @@
7#ifndef lundump_h 7#ifndef lundump_h
8#define lundump_h 8#define lundump_h
9 9
10#include <limits.h>
11
10#include "llimits.h" 12#include "llimits.h"
11#include "lobject.h" 13#include "lobject.h"
12#include "lzio.h" 14#include "lzio.h"
@@ -25,6 +27,19 @@
25 27
26#define LUAC_FORMAT 0 /* this is the official format */ 28#define LUAC_FORMAT 0 /* this is the official format */
27 29
30
31/*
32** Type to handle MSB Varint encoding: Try to get the largest unsigned
33** integer available. (It was enough to be the largest between size_t and
34** lua_Integer, but the C89 preprocessor knows nothing about size_t.)
35*/
36#if !defined(LUA_USE_C89) && defined(LLONG_MAX)
37typedef unsigned long long varint_t;
38#else
39typedef unsigned long varint_t;
40#endif
41
42
28/* load one chunk; from lundump.c */ 43/* load one chunk; from lundump.c */
29LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name, 44LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name,
30 int fixed); 45 int fixed);