llimits.h being used by all Lua code · lua/lua@a08d82e · GitHub
Skip to content

Commit a08d82e

Browse files
committed
llimits.h being used by all Lua code
The definitions in llimits.h are useful not only for the core. That header only defines types and '#define's, so libs and core still do not share any real code/data.
1 parent 55ac40f commit a08d82e

14 files changed

Lines changed: 48 additions & 73 deletions

‎lauxlib.c‎

Lines changed: 1 addition & 0 deletions

‎lauxlib.h‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -168,21 +168,6 @@ LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname,
168168
#define luaL_pushfail(L) lua_pushnil(L)
169169

170170

171-
/*
172-
** Internal assertions for in-house debugging
173-
*/
174-
#if !defined(lua_assert)
175-
176-
#if defined LUAI_ASSERT
177-
#include <assert.h>
178-
#define lua_assert(c) assert(c)
179-
#else
180-
#define lua_assert(c) ((void)0)
181-
#endif
182-
183-
#endif
184-
185-
186171

187172
/*
188173
** {======================================================

‎lbaselib.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include "lauxlib.h"
2121
#include "lualib.h"
22+
#include "llimits.h"
2223

2324

2425
static int luaB_print (lua_State *L) {

‎lcorolib.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include "lauxlib.h"
1818
#include "lualib.h"
19+
#include "llimits.h"
1920

2021

2122
static lua_State *getco (lua_State *L) {

‎ldblib.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include "lauxlib.h"
2020
#include "lualib.h"
21+
#include "llimits.h"
2122

2223

2324
/*

‎linit.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include "lualib.h"
2020
#include "lauxlib.h"
21+
#include "llimits.h"
2122

2223

2324
/*

‎liolib.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121

2222
#include "lauxlib.h"
2323
#include "lualib.h"
24-
25-
24+
#include "llimits.h"
2625

2726

2827
/*

‎lmathlib.c‎

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#include "lauxlib.h"
2222
#include "lualib.h"
23+
#include "llimits.h"
2324

2425

2526
#undef PI
@@ -366,25 +367,17 @@ static lua_Number I2d (Rand64 x) {
366367

367368
#else /* no 'Rand64' }{ */
368369

369-
/* get an integer with at least 32 bits */
370-
#if LUAI_IS32INT
371-
typedef unsigned int lu_int32;
372-
#else
373-
typedef unsigned long lu_int32;
374-
#endif
375-
376-
377370
/*
378371
** Use two 32-bit integers to represent a 64-bit quantity.
379372
*/
380373
typedef struct Rand64 {
381-
lu_int32 h; /* higher half */
382-
lu_int32 l; /* lower half */
374+
l_uint32 h; /* higher half */
375+
l_uint32 l; /* lower half */
383376
} Rand64;
384377

385378

386379
/*
387-
** If 'lu_int32' has more than 32 bits, the extra bits do not interfere
380+
** If 'l_uint32' has more than 32 bits, the extra bits do not interfere
388381
** with the 32 initial bits, except in a right shift and comparisons.
389382
** Moreover, the final result has to discard the extra bits.
390383
*/
@@ -398,7 +391,7 @@ typedef struct Rand64 {
398391
*/
399392

400393
/* build a new Rand64 value */
401-
static Rand64 packI (lu_int32 h, lu_int32 l) {
394+
static Rand64 packI (l_uint32 h, l_uint32 l) {
402395
Rand64 result;
403396
result.h = h;
404397
result.l = l;
@@ -471,7 +464,7 @@ static Rand64 nextrand (Rand64 *state) {
471464
*/
472465

473466
/* an unsigned 1 with proper type */
474-
#define UONE ((lu_int32)1)
467+
#define UONE ((l_uint32)1)
475468

476469

477470
#if FIGS <= 32
@@ -522,7 +515,7 @@ static lua_Unsigned I2UInt (Rand64 x) {
522515

523516
/* convert a 'lua_Unsigned' to a 'Rand64' */
524517
static Rand64 Int2I (lua_Unsigned n) {
525-
return packI((lu_int32)((n >> 31) >> 1), (lu_int32)n);
518+
return packI((l_uint32)((n >> 31) >> 1), (l_uint32)n);
526519
}
527520

528521
#endif /* } */

‎loadlib.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include "lauxlib.h"
2424
#include "lualib.h"
25+
#include "llimits.h"
2526

2627

2728
/*

‎loslib.c‎

Lines changed: 1 addition & 0 deletions

0 commit comments

Comments
 (0)