diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-06-13 11:13:06 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-06-13 11:13:06 -0300 |
| commit | fd80e63468f0c08fedd8dbf944fa4954b72d7384 (patch) | |
| tree | e074a257d1eb265eaaafeb930e94282a72d27f88 /luaconf.h | |
| parent | f62565abea4e56f6bd064df83e5b0f3818b99d82 (diff) | |
| download | lua-fd80e63468f0c08fedd8dbf944fa4954b72d7384.tar.gz lua-fd80e63468f0c08fedd8dbf944fa4954b72d7384.tar.bz2 lua-fd80e63468f0c08fedd8dbf944fa4954b72d7384.zip | |
configuration for NaN trick big-endian + macro 'luai_checknum' to
ensure numbers comming from C are not "improper" (some kinds of
signaling NaNs)
Diffstat (limited to 'luaconf.h')
| -rw-r--r-- | luaconf.h | 32 |
1 files changed, 28 insertions, 4 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: luaconf.h,v 1.157 2011/04/29 13:56:28 roberto Exp roberto $ | 2 | ** $Id: luaconf.h,v 1.158 2011/05/26 16:09:40 roberto Exp roberto $ |
| 3 | ** Configuration file for Lua | 3 | ** Configuration file for Lua |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -465,11 +465,11 @@ | |||
| 465 | 465 | ||
| 466 | /* | 466 | /* |
| 467 | @@ LUA_IEEEENDIAN is the endianness of doubles in your machine | 467 | @@ LUA_IEEEENDIAN is the endianness of doubles in your machine |
| 468 | @@ (0 for little endian, 1 for big endian); if not defined, Lua will | 468 | ** (0 for little endian, 1 for big endian); if not defined, Lua will |
| 469 | @@ check it dynamically. | 469 | ** check it dynamically. |
| 470 | */ | 470 | */ |
| 471 | /* check for known architectures */ | 471 | /* check for known architectures */ |
| 472 | #if defined(__i386__) || defined(__i386) || defined(i386) || \ | 472 | #if defined(__i386__) || defined(__i386) || defined(__X86__) || \ |
| 473 | defined (__x86_64) | 473 | defined (__x86_64) |
| 474 | #define LUA_IEEEENDIAN 0 | 474 | #define LUA_IEEEENDIAN 0 |
| 475 | #elif defined(__POWERPC__) || defined(__ppc__) | 475 | #elif defined(__POWERPC__) || defined(__ppc__) |
| @@ -485,6 +485,30 @@ | |||
| 485 | /* }================================================================== */ | 485 | /* }================================================================== */ |
| 486 | 486 | ||
| 487 | 487 | ||
| 488 | /* | ||
| 489 | @@ LUA_NANTRICKLE/LUA_NANTRICKBE controls the use of a trick to pack all | ||
| 490 | ** types into a single double value, using NaN values to represent | ||
| 491 | ** non-number values. The trick only works on 32-bit machines (ints and | ||
| 492 | ** pointers are 32-bit values) with numbers represented as IEEE 754-2008 | ||
| 493 | ** doubles with conventional endianess (12345678 or 87654321), in CPUs | ||
| 494 | ** that do not produce signaling NaN values (all NaNs are quiet). | ||
| 495 | */ | ||
| 496 | #if defined(LUA_CORE) /* { */ | ||
| 497 | |||
| 498 | #if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) /* { */ | ||
| 499 | |||
| 500 | /* little-endian architectures that satisfy those conditions */ | ||
| 501 | #if defined(__i386__) || defined(__i386) || defined(__X86__) | ||
| 502 | |||
| 503 | #define LUA_NANTRICKLE | ||
| 504 | |||
| 505 | #endif | ||
| 506 | |||
| 507 | #endif /* } */ | ||
| 508 | |||
| 509 | #endif /* } */ | ||
| 510 | |||
| 511 | |||
| 488 | 512 | ||
| 489 | 513 | ||
| 490 | /* =================================================================== */ | 514 | /* =================================================================== */ |
