mirror of https://github.com/rusefi/lua.git
new macro for conversion double->int + small changes
This commit is contained in:
parent
e4324f54b9
commit
b261cd110f
80
luaconf.h
80
luaconf.h
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: luaconf.h,v 1.53 2005/06/13 21:20:28 roberto Exp roberto $
|
** $Id: luaconf.h,v 1.54 2005/07/05 14:31:45 roberto Exp roberto $
|
||||||
** Configuration file for Lua
|
** Configuration file for Lua
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -41,22 +41,27 @@
|
||||||
** non-conventional directories.
|
** non-conventional directories.
|
||||||
*/
|
*/
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#define LUA_ROOT "C:\\Program Files\\Lua51"
|
/*
|
||||||
#define LUA_LDIR LUA_ROOT "\\lua"
|
** In Windows, any exclamation mark ('!') in the path is replaced by the
|
||||||
#define LUA_CDIR LUA_ROOT "\\dll"
|
** path of the directory of the executable file of the current process.
|
||||||
|
*/
|
||||||
|
#define LUA_LDIR "!\\lua"
|
||||||
|
#define LUA_CDIR "!\\dll"
|
||||||
#define LUA_PATH_DEFAULT \
|
#define LUA_PATH_DEFAULT \
|
||||||
"?.lua;" LUA_LDIR"\\?.lua;" LUA_LDIR"\\?\\init.lua"
|
"?.lua;" LUA_LDIR"\\?.lua;" LUA_LDIR"\\?\\init.lua;" \
|
||||||
|
LUA_CDIR"\\?.lua;" LUA_CDIR"\\?\\init.lua"
|
||||||
#define LUA_CPATH_DEFAULT \
|
#define LUA_CPATH_DEFAULT \
|
||||||
"?.dll;" "l?.dll;" LUA_CDIR"\\?.dll;" LUA_CDIR"\\l?.dll"
|
"?.dll;" LUA_CDIR"\\?.dll;" LUA_CDIR"\\loadall.dll"
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define LUA_ROOT "/usr/local"
|
#define LUA_ROOT "/usr/local"
|
||||||
#define LUA_LDIR LUA_ROOT "/share/lua/5.1"
|
#define LUA_LDIR LUA_ROOT "/share/lua/5.1"
|
||||||
#define LUA_CDIR LUA_ROOT "/lib/lua/5.1"
|
#define LUA_CDIR LUA_ROOT "/lib/lua/5.1"
|
||||||
#define LUA_PATH_DEFAULT \
|
#define LUA_PATH_DEFAULT \
|
||||||
"./?.lua;" LUA_LDIR"/?.lua;" LUA_LDIR"/?/init.lua"
|
"./?.lua;" LUA_LDIR"/?.lua;" LUA_LDIR"/?/init.lua;" \
|
||||||
|
LUA_CDIR"/?.lua;" LUA_CDIR"/?/init.lua"
|
||||||
#define LUA_CPATH_DEFAULT \
|
#define LUA_CPATH_DEFAULT \
|
||||||
"./?.so;" "./l?.so;" LUA_CDIR"/?.so;" LUA_CDIR"/l?.so"
|
"./?.so;" LUA_CDIR"/?.so;" LUA_CDIR"/loadall.so"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,21 +79,17 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ LUA_PATHSEP is the character that separates templates in a path.
|
@@ LUA_PATHSEP is the character that separates templates in a path.
|
||||||
** CHANGE it if for some reason your system cannot use a
|
|
||||||
** semicolon. (E.g., if a semicolon is a common character in
|
|
||||||
** file/directory names.) Probably you do not need to change this.
|
|
||||||
*/
|
|
||||||
#define LUA_PATHSEP ';'
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
@@ LUA_PATH_MARK is the string that marks the substitution points in a
|
@@ LUA_PATH_MARK is the string that marks the substitution points in a
|
||||||
@* template.
|
@* template.
|
||||||
** CHANGE it if for some reason your system cannot use an interrogation
|
@@ LUA_EXECDIR in a Windows path is replaced by the executable's
|
||||||
** mark. (E.g., if an interogation mark is a common character in
|
@* directory.
|
||||||
** file/directory names.) Probably you do not need to change this.
|
** CHANGE them if for some reason your system cannot use those
|
||||||
|
** characters. (E.g., if one of those characters is a common character
|
||||||
|
** in file/directory names.) Probably you do not need to change them.
|
||||||
*/
|
*/
|
||||||
|
#define LUA_PATHSEP ";"
|
||||||
#define LUA_PATH_MARK "?"
|
#define LUA_PATH_MARK "?"
|
||||||
|
#define LUA_EXECDIR "!"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -464,44 +465,23 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ lua_number2int is a macro to convert lua_Number to int.
|
@@ lua_number2int is a macro to convert lua_Number to int.
|
||||||
** CHANGE that if you know a faster way to convert a lua_Number to
|
@@ lua_number2integer is a macro to convert lua_Number to lua_Integer.
|
||||||
|
** CHANGE them if you know a faster way to convert a lua_Number to
|
||||||
** int (with any rounding method and without throwing errors) in your
|
** int (with any rounding method and without throwing errors) in your
|
||||||
** system. In Pentium machines, a naive typecast from double to int
|
** system. In Pentium machines, a naive typecast from double to int
|
||||||
** in C is extremely slow, so any alternative is worth trying.
|
** in C is extremely slow, so any alternative is worth trying.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* On a gcc/Pentium, resort to assembler */
|
/* On a Pentium, resort to a trick */
|
||||||
#if !defined(LUA_ANSI) && defined(__GNUC__) && defined(__i386)
|
#if !defined(LUA_ANSI) && (defined(__i386) || defined (_M_IX86))
|
||||||
#define lua_number2int(i,d) __asm__ ("fistpl %0":"=m"(i):"t"(d):"st")
|
union luai_Cast { double l_d; long l_l; };
|
||||||
|
#define lua_number2int(i,d) \
|
||||||
/* On Windows/Pentium, resort to assembler */
|
{ union luai_Cast u; u.l_d = d + 6755399441055744.0; (i) = u.l_l; }
|
||||||
#elif !defined(LUA_ANSI) && defined(_MSC_VER) && defined(_M_IX86)
|
|
||||||
#define lua_number2int(i,d) __asm fld d __asm fistp i
|
|
||||||
|
|
||||||
|
|
||||||
/* on Pentium machines compliant with C99, you can try lrint */
|
|
||||||
#elif defined (__i386) && defined(__STDC_VERSION__) && \
|
|
||||||
(__STDC_VERSION__ >= 199900L)
|
|
||||||
#define lua_number2int(i,d) ((i)=lrint(d))
|
|
||||||
|
|
||||||
/* this option always works, but may be slow */
|
|
||||||
#else
|
|
||||||
#define lua_number2int(i,d) ((i)=(int)(d))
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
@@ lua_number2integer is a macro to convert lua_Number to lua_Integer.
|
|
||||||
** CHANGE (see lua_number2int).
|
|
||||||
*/
|
|
||||||
/* On a gcc or Windows/Pentium, resort to assembler */
|
|
||||||
#if (defined(__GNUC__) && defined(__i386)) || \
|
|
||||||
(defined(_MSC_VER) && defined(_M_IX86))
|
|
||||||
#define lua_number2integer(i,n) lua_number2int(i, n)
|
#define lua_number2integer(i,n) lua_number2int(i, n)
|
||||||
|
|
||||||
/* this option always works, but may be slow */
|
/* this option always works, but may be slow */
|
||||||
#else
|
#else
|
||||||
|
#define lua_number2int(i,d) ((i)=(int)(d))
|
||||||
#define lua_number2integer(i,d) ((i)=(lua_Integer)(d))
|
#define lua_number2integer(i,d) ((i)=(lua_Integer)(d))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -517,12 +497,12 @@
|
||||||
** ===================================================================
|
** ===================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define LUA_NUMBER double
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
|
@@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
|
||||||
@* over a number.
|
@* over a number.
|
||||||
*/
|
*/
|
||||||
#define LUA_NUMBER double
|
|
||||||
#define LUAI_UACNUMBER double
|
#define LUAI_UACNUMBER double
|
||||||
|
|
||||||
|
|
||||||
|
@ -572,7 +552,7 @@
|
||||||
** CHANGE them if you prefer to use longjmp/setjmp even with C++ or
|
** CHANGE them if you prefer to use longjmp/setjmp even with C++ or
|
||||||
** if want/don't want to use _longjmp/_setjmp instead of regular
|
** if want/don't want to use _longjmp/_setjmp instead of regular
|
||||||
** longjmp/setjmp. By default, Lua handles errors with exceptions when
|
** longjmp/setjmp. By default, Lua handles errors with exceptions when
|
||||||
** compiling as C++ code, with _longjmp/_setjmp when compiling as C code
|
* compiling as C++ code, with _longjmp/_setjmp when compiling as C code
|
||||||
** in a Unix system, and with longjmp/setjmp otherwise.
|
** in a Unix system, and with longjmp/setjmp otherwise.
|
||||||
*/
|
*/
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
|
|
Loading…
Reference in New Issue