mirror of
https://github.com/lua/lua
synced 2026-09-27 00:28:25 +03:00
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.
This commit is contained in:
parent
7360f8d0fd
commit
c8121ce34b
3 changed files with 45 additions and 29 deletions
15
lundump.h
15
lundump.h
|
|
@ -7,6 +7,8 @@
|
|||
#ifndef lundump_h
|
||||
#define lundump_h
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include "llimits.h"
|
||||
#include "lobject.h"
|
||||
#include "lzio.h"
|
||||
|
|
@ -25,6 +27,19 @@
|
|||
|
||||
#define LUAC_FORMAT 0 /* this is the official format */
|
||||
|
||||
|
||||
/*
|
||||
** Type to handle MSB Varint encoding: Try to get the largest unsigned
|
||||
** integer available. (It was enough to be the largest between size_t and
|
||||
** lua_Integer, but the C89 preprocessor knows nothing about size_t.)
|
||||
*/
|
||||
#if !defined(LUA_USE_C89) && defined(LLONG_MAX)
|
||||
typedef unsigned long long varint_t;
|
||||
#else
|
||||
typedef unsigned long varint_t;
|
||||
#endif
|
||||
|
||||
|
||||
/* load one chunk; from lundump.c */
|
||||
LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name,
|
||||
int fixed);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue