aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--llimits.h49
-rw-r--r--luaconf.h51
2 files changed, 50 insertions, 50 deletions
diff --git a/llimits.h b/llimits.h
index c4719a15..d115496f 100644
--- a/llimits.h
+++ b/llimits.h
@@ -287,6 +287,55 @@ typedef unsigned long l_uint32;
287#endif 287#endif
288 288
289 289
290
291/*
292** lua_numbertointeger converts a float number with an integral value
293** to an integer, or returns 0 if the float is not within the range of
294** a lua_Integer. (The range comparisons are tricky because of
295** rounding. The tests here assume a two-complement representation,
296** where MININTEGER always has an exact representation as a float;
297** MAXINTEGER may not have one, and therefore its conversion to float
298** may have an ill-defined value.)
299*/
300#define lua_numbertointeger(n,p) \
301 ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \
302 (n) < -(LUA_NUMBER)(LUA_MININTEGER) && \
303 (*(p) = (LUA_INTEGER)(n), 1))
304
305
306
307/*
308** LUAI_FUNC is a mark for all extern functions that are not to be
309** exported to outside modules.
310** LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables,
311** none of which to be exported to outside modules (LUAI_DDEF for
312** definitions and LUAI_DDEC for declarations).
313** Elf/gcc (versions 3.2 and later) mark them as "hidden" to optimize
314** access when Lua is compiled as a shared library. Not all elf targets
315** support this attribute. Unfortunately, gcc does not offer a way to
316** check whether the target offers that support, and those without
317** support give a warning about it. To avoid these warnings, change to
318** the default definition.
319*/
320#if !defined(LUAI_FUNC)
321
322#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
323 defined(__ELF__) /* { */
324#define LUAI_FUNC __attribute__((visibility("internal"))) extern
325#else /* }{ */
326#define LUAI_FUNC extern
327#endif /* } */
328
329#define LUAI_DDEC(dec) LUAI_FUNC dec
330#define LUAI_DDEF /* empty */
331
332#endif
333
334
335/* Give these macros simpler names for internal use */
336#define l_likely(x) luai_likely(x)
337#define l_unlikely(x) luai_unlikely(x)
338
290/* 339/*
291** {================================================================== 340** {==================================================================
292** "Abstraction Layer" for basic report of messages and errors 341** "Abstraction Layer" for basic report of messages and errors
diff --git a/luaconf.h b/luaconf.h
index 56d29165..b42da518 100644
--- a/luaconf.h
+++ b/luaconf.h
@@ -321,31 +321,6 @@
321#define LUALIB_API LUA_API 321#define LUALIB_API LUA_API
322#define LUAMOD_API LUA_API 322#define LUAMOD_API LUA_API
323 323
324
325/*
326@@ LUAI_FUNC is a mark for all extern functions that are not to be
327** exported to outside modules.
328@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables,
329** none of which to be exported to outside modules (LUAI_DDEF for
330** definitions and LUAI_DDEC for declarations).
331** CHANGE them if you need to mark them in some special way. Elf/gcc
332** (versions 3.2 and later) mark them as "hidden" to optimize access
333** when Lua is compiled as a shared library. Not all elf targets support
334** this attribute. Unfortunately, gcc does not offer a way to check
335** whether the target offers that support, and those without support
336** give a warning about it. To avoid these warnings, change to the
337** default definition.
338*/
339#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
340 defined(__ELF__) /* { */
341#define LUAI_FUNC __attribute__((visibility("internal"))) extern
342#else /* }{ */
343#define LUAI_FUNC extern
344#endif /* } */
345
346#define LUAI_DDEC(dec) LUAI_FUNC dec
347#define LUAI_DDEF /* empty */
348
349/* }================================================================== */ 324/* }================================================================== */
350 325
351 326
@@ -415,26 +390,11 @@
415*/ 390*/
416 391
417 392
418/* The following definitions are good for most cases here */ 393/* The following definition is good for most cases here */
419 394
420#define l_floor(x) (l_mathop(floor)(x)) 395#define l_floor(x) (l_mathop(floor)(x))
421 396
422 397
423/*
424@@ lua_numbertointeger converts a float number with an integral value
425** to an integer, or returns 0 if float is not within the range of
426** a lua_Integer. (The range comparisons are tricky because of
427** rounding. The tests here assume a two-complement representation,
428** where MININTEGER always has an exact representation as a float;
429** MAXINTEGER may not have one, and therefore its conversion to float
430** may have an ill-defined value.)
431*/
432#define lua_numbertointeger(n,p) \
433 ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \
434 (n) < -(LUA_NUMBER)(LUA_MININTEGER) && \
435 (*(p) = (LUA_INTEGER)(n), 1))
436
437
438/* now the variable definitions */ 398/* now the variable definitions */
439 399
440#if LUA_FLOAT_TYPE == LUA_FLOAT_FLOAT /* { single float */ 400#if LUA_FLOAT_TYPE == LUA_FLOAT_FLOAT /* { single float */
@@ -694,13 +654,6 @@
694#endif 654#endif
695 655
696 656
697#if defined(LUA_CORE) || defined(LUA_LIB)
698/* shorter names for Lua's own use */
699#define l_likely(x) luai_likely(x)
700#define l_unlikely(x) luai_unlikely(x)
701#endif
702
703
704 657
705/* }================================================================== */ 658/* }================================================================== */
706 659
@@ -782,7 +735,5 @@
782 735
783 736
784 737
785
786
787#endif 738#endif
788 739