diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-06-19 11:27:00 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-06-19 11:27:00 -0300 |
commit | 130c0e40e01e24a79f7e416d1cc4187cd4a2a5fc (patch) | |
tree | 946ed95a3c70012ba57e0be4abdd4a5e7263fc44 /llimits.h | |
parent | c72fb1cf8e0869aa4adc894c4e28f9d1be2e6574 (diff) | |
download | lua-130c0e40e01e24a79f7e416d1cc4187cd4a2a5fc.tar.gz lua-130c0e40e01e24a79f7e416d1cc4187cd4a2a5fc.tar.bz2 lua-130c0e40e01e24a79f7e416d1cc4187cd4a2a5fc.zip |
new constant 'MAX_SIZE', distinct from 'MAX_SIZET', for sizes visible
from Lua; these must fit in a lua_Integer
Diffstat (limited to 'llimits.h')
-rw-r--r-- | llimits.h | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llimits.h,v 1.106 2013/05/27 12:43:37 roberto Exp roberto $ | 2 | ** $Id: llimits.h,v 1.107 2013/05/29 14:04:15 roberto Exp roberto $ |
3 | ** Limits, basic types, and some other `installation-dependent' definitions | 3 | ** Limits, basic types, and some other `installation-dependent' definitions |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -27,8 +27,14 @@ typedef LUAI_MEM l_mem; | |||
27 | typedef unsigned char lu_byte; | 27 | typedef unsigned char lu_byte; |
28 | 28 | ||
29 | 29 | ||
30 | /* maximum value for size_t */ | ||
30 | #define MAX_SIZET ((size_t)(~(size_t)0)-2) | 31 | #define MAX_SIZET ((size_t)(~(size_t)0)-2) |
31 | 32 | ||
33 | /* maximum size visible for Lua (must be representable in a lua_Integer */ | ||
34 | #define MAX_SIZE (sizeof(size_t) <= sizeof(lua_Integer) ? MAX_SIZET \ | ||
35 | : (size_t)(~(lua_Unsigned)0)-2) | ||
36 | |||
37 | |||
32 | #define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2) | 38 | #define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2) |
33 | 39 | ||
34 | #define MAX_LMEM ((l_mem) ((MAX_LUMEM >> 1) - 2)) | 40 | #define MAX_LMEM ((l_mem) ((MAX_LUMEM >> 1) - 2)) |