summaryrefslogtreecommitdiff
path: root/llimits.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-02-20 15:15:33 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-02-20 15:15:33 -0300
commit099442c41f2cec6122690e6c8f2e11327613e6f6 (patch)
tree73599b274ea4a9b96906ff8160eeb4a524702a8e /llimits.h
parent27600fe87a6fafdfd4ddddeb390591fe749b480f (diff)
downloadlua-099442c41f2cec6122690e6c8f2e11327613e6f6.tar.gz
lua-099442c41f2cec6122690e6c8f2e11327613e6f6.tar.bz2
lua-099442c41f2cec6122690e6c8f2e11327613e6f6.zip
better separation between basic types
Diffstat (limited to 'llimits.h')
-rw-r--r--llimits.h34
1 files changed, 26 insertions, 8 deletions
diff --git a/llimits.h b/llimits.h
index 37bf85dc..1fbfd1d9 100644
--- a/llimits.h
+++ b/llimits.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llimits.h,v 1.21 2000/12/04 18:33:40 roberto Exp roberto $ 2** $Id: llimits.h,v 1.22 2001/02/09 16:24:44 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*/
@@ -40,11 +40,27 @@
40 40
41 41
42 42
43typedef unsigned long luint32; /* unsigned int with at least 32 bits */ 43/*
44typedef long lint32; /* signed int with at least 32 bits */ 44** the following types define integer types for values that may not
45** fit in a "small int" (16 bits), but may waste space in a
46** "large long" (64 bits). The current definitions should work in
47** any machine, but may not be optimal.
48*/
49
50/* an unsigned integer to hold hash values */
51typedef unsigned int lu_hash;
52/* its signed equivalent */
53typedef int ls_hash;
45 54
46/* an unsigned integer big enough to count the total memory used by Lua */ 55/* an unsigned integer big enough to count the total memory used by Lua */
47typedef unsigned long mem_int; 56typedef unsigned long lu_mem;
57
58/* an integer big enough to count the number of strings in use */
59typedef long ls_nstr;
60
61
62/* chars used as small naturals (so that `char' is reserved for characteres) */
63typedef unsigned char lu_byte;
48 64
49 65
50#define MAX_SIZET ((size_t)(~(size_t)0)-2) 66#define MAX_SIZET ((size_t)(~(size_t)0)-2)
@@ -53,10 +69,12 @@ typedef unsigned long mem_int;
53#define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */ 69#define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */
54 70
55/* 71/*
56** conversion of pointer to int (for hashing only) 72** conversion of pointer to integer
73** this is for hashing only; there is no problem if the integer
74** cannot hold the whole pointer value
57** (the shift removes bits that are usually 0 because of alignment) 75** (the shift removes bits that are usually 0 because of alignment)
58*/ 76*/
59#define IntPoint(p) (((luint32)(p)) >> 3) 77#define IntPoint(p) ((((lu_hash)(p)) >> 4) ^ (lu_hash)(p))
60 78
61 79
62 80
@@ -71,7 +89,7 @@ typedef unsigned long mem_int;
71 89
72 90
73/* type to ensure maximum alignment */ 91/* type to ensure maximum alignment */
74union L_Umaxalign { double d; char *s; long l; }; 92union L_Umaxalign { double d; void *s; long l; };
75 93
76 94
77 95
@@ -81,7 +99,7 @@ union L_Umaxalign { double d; char *s; long l; };
81** For a very small machine, you may change that to 2 bytes (and adjust 99** For a very small machine, you may change that to 2 bytes (and adjust
82** the following limits accordingly) 100** the following limits accordingly)
83*/ 101*/
84typedef luint32 Instruction; 102typedef unsigned long Instruction;
85 103
86 104
87/* 105/*