From 38908616d0e08b72e6b00d18490ed917fa643e4f Mon Sep 17 00:00:00 2001 From: Li Jin Date: Tue, 17 Aug 2021 23:09:27 +0800 Subject: reset Yuescript version since it's a minor version with new feature. update Lua lib. --- src/3rdParty/lua/lstrlib.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/3rdParty/lua/lstrlib.c') diff --git a/src/3rdParty/lua/lstrlib.c b/src/3rdParty/lua/lstrlib.c index 47e5b27..74501f7 100644 --- a/src/3rdParty/lua/lstrlib.c +++ b/src/3rdParty/lua/lstrlib.c @@ -1352,15 +1352,6 @@ static const union { } nativeendian = {1}; -/* dummy structure to get native alignment requirements */ -struct cD { - char c; - union { double d; void *p; lua_Integer i; lua_Number n; } u; -}; - -#define MAXALIGN (offsetof(struct cD, u)) - - /* ** information to pack/unpack stuff */ @@ -1435,6 +1426,8 @@ static void initheader (lua_State *L, Header *h) { ** Read and classify next option. 'size' is filled with option's size. */ static KOption getoption (Header *h, const char **fmt, int *size) { + /* dummy structure to get native alignment requirements */ + struct cD { char c; union { LUAI_MAXALIGN; } u; }; int opt = *((*fmt)++); *size = 0; /* default */ switch (opt) { @@ -1465,7 +1458,11 @@ static KOption getoption (Header *h, const char **fmt, int *size) { case '<': h->islittle = 1; break; case '>': h->islittle = 0; break; case '=': h->islittle = nativeendian.little; break; - case '!': h->maxalign = getnumlimit(h, fmt, MAXALIGN); break; + case '!': { + const int maxalign = offsetof(struct cD, u); + h->maxalign = getnumlimit(h, fmt, maxalign); + break; + } default: luaL_error(h->L, "invalid format option '%c'", opt); } return Knop; -- cgit v1.2.3-55-g6feb