浏览代码

new macros LUA_MAXINTEGER/LUA_MININTEGER

Roberto Ierusalimschy 11 年之前
父节点
当前提交
be52f784d9
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      luaconf.h

+ 6 - 1
luaconf.h

@@ -1,5 +1,5 @@
 /*
-** $Id: luaconf.h,v 1.192 2014/03/18 18:27:08 roberto Exp roberto $
+** $Id: luaconf.h,v 1.193 2014/03/21 14:27:16 roberto Exp roberto $
 ** Configuration file for Lua
 ** See Copyright Notice in lua.h
 */
@@ -531,6 +531,8 @@
 @@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers.
 @@ LUA_INTEGER_SCAN is the format for reading integers.
 @@ LUA_INTEGER_FMT is the format for writing integers.
+@@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER.
+@@ LUA_MININTEGER is the minimum value for a LUA_INTEGER.
 @@ lua_integer2str converts an integer to a string.
 */
 
@@ -567,6 +569,9 @@
 
 #define LUA_UNSIGNED		unsigned LUA_INTEGER
 
+#define LUA_MAXINTEGER		((LUA_INTEGER)(~(LUA_UNSIGNED)0 >> 1))
+#define LUA_MININTEGER		((LUA_INTEGER)~(~(LUA_UNSIGNED)0 >> 1))
+
 /* }================================================================== */