Browse Source

added macro MAX_UINTEGER

pull/9/head
Roberto Ierusalimschy 11 years ago
parent
commit
11e762dbcd
  1. 8
      llimits.h

8
llimits.h

@ -1,5 +1,5 @@
/* /*
** $Id: llimits.h,v 1.108 2013/06/19 14:27:00 roberto Exp roberto $ ** $Id: llimits.h,v 1.109 2013/08/21 19:02:30 roberto Exp roberto $
** Limits, basic types, and some other `installation-dependent' definitions ** Limits, basic types, and some other `installation-dependent' definitions
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -43,11 +43,13 @@ typedef unsigned char lu_byte;
#define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */ #define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */
/* maximum value for a lua_Unsigned */
#define MAX_UINTEGER (~(lua_Unsigned)0)
/* minimum and maximum values for lua_Integer */ /* minimum and maximum values for lua_Integer */
#define MAX_INTEGER ((lua_Integer)(~(lua_Unsigned)0 >> 1)) #define MAX_INTEGER ((lua_Integer)(MAX_UINTEGER >> 1))
#define MIN_INTEGER (~MAX_INTEGER) #define MIN_INTEGER (~MAX_INTEGER)
/* /*
** conversion of pointer to integer ** conversion of pointer to integer
** this is for hashing only; there is no problem if the integer ** this is for hashing only; there is no problem if the integer

Loading…
Cancel
Save