diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-01-19 17:49:22 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-01-19 17:49:22 -0200 |
| commit | d49e4dd752928c5869a75c444b503060b2634968 (patch) | |
| tree | 4e13ace68c6940dd12efae1014b18237e1004caa /lobject.h | |
| parent | 981fddea022b6cad7768223353b4e7386080c271 (diff) | |
| download | lua-d49e4dd752928c5869a75c444b503060b2634968.tar.gz lua-d49e4dd752928c5869a75c444b503060b2634968.tar.bz2 lua-d49e4dd752928c5869a75c444b503060b2634968.zip | |
MAX_WORD should not be bigger than MAX_INT
Diffstat (limited to 'lobject.h')
| -rw-r--r-- | lobject.h | 13 |
1 files changed, 10 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.h,v 1.15 1998/01/13 13:27:25 roberto Exp $ | 2 | ** $Id: lobject.h,v 1.15 1998/01/14 13:48:28 roberto Exp roberto $ |
| 3 | ** Type definitions for Lua objects | 3 | ** Type definitions for Lua objects |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -25,8 +25,15 @@ | |||
| 25 | #define Byte lua_Byte /* some systems have Byte as a predefined type */ | 25 | #define Byte lua_Byte /* some systems have Byte as a predefined type */ |
| 26 | typedef unsigned char Byte; /* unsigned 8 bits */ | 26 | typedef unsigned char Byte; /* unsigned 8 bits */ |
| 27 | 27 | ||
| 28 | #define MAX_WORD (65534U) /* maximum value of a word (-2 for safety) */ | 28 | |
| 29 | #define MAX_INT (INT_MAX-2) /* maximum value of a int (-2 for safety) */ | 29 | #define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */ |
| 30 | |||
| 31 | /* maximum value of a word of 2 bytes (-2 for safety); must fit in an "int" */ | ||
| 32 | #if MAX_INT < 65534 | ||
| 33 | #define MAX_WORD MAX_INT | ||
| 34 | #else | ||
| 35 | #define MAX_WORD 65534 | ||
| 36 | #endif | ||
| 30 | 37 | ||
| 31 | typedef unsigned int IntPoint; /* unsigned with same size as a pointer (for hashing) */ | 38 | typedef unsigned int IntPoint; /* unsigned with same size as a pointer (for hashing) */ |
| 32 | 39 | ||
