diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-04-28 10:33:53 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-04-28 10:33:53 -0300 |
commit | 460a35cbcb33fbc56f5a658b96a793b9bb8963e9 (patch) | |
tree | 138df91e9dec0544b64bad3334d01ca38d2b7408 /lptypes.h | |
parent | 503126fec29117e31d633b81203f887b99040c4a (diff) | |
download | lpeg-460a35cbcb33fbc56f5a658b96a793b9bb8963e9.tar.gz lpeg-460a35cbcb33fbc56f5a658b96a793b9bb8963e9.tar.bz2 lpeg-460a35cbcb33fbc56f5a658b96a793b9bb8963e9.zip |
New type name 'uint' (unsigned int)
Diffstat (limited to 'lptypes.h')
-rw-r--r-- | lptypes.h | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -83,6 +83,8 @@ typedef size_t lua_Unsigned; | |||
83 | 83 | ||
84 | typedef unsigned char byte; | 84 | typedef unsigned char byte; |
85 | 85 | ||
86 | typedef unsigned int uint; | ||
87 | |||
86 | 88 | ||
87 | #define BITSPERCHAR 8 | 89 | #define BITSPERCHAR 8 |
88 | 90 | ||
@@ -102,7 +104,7 @@ typedef struct Charset { | |||
102 | #define clearset(s) fillset(s,0) | 104 | #define clearset(s) fillset(s,0) |
103 | 105 | ||
104 | /* number of slots needed for 'n' bytes */ | 106 | /* number of slots needed for 'n' bytes */ |
105 | #define bytes2slots(n) (((n) - 1u) / (unsigned int)sizeof(TTree) + 1u) | 107 | #define bytes2slots(n) (((n) - 1u) / (uint)sizeof(TTree) + 1u) |
106 | 108 | ||
107 | /* set 'b' bit in charset 'cs' */ | 109 | /* set 'b' bit in charset 'cs' */ |
108 | #define setchar(cs,b) ((cs)[(b) >> 3] |= (1 << ((b) & 7))) | 110 | #define setchar(cs,b) ((cs)[(b) >> 3] |= (1 << ((b) & 7))) |
@@ -129,8 +131,8 @@ typedef struct Charset { | |||
129 | 131 | ||
130 | 132 | ||
131 | /* size (in instructions) for l bytes (l > 0) */ | 133 | /* size (in instructions) for l bytes (l > 0) */ |
132 | #define instsize(l) ((int)(((l) + (unsigned int)sizeof(Instruction) - 1u) \ | 134 | #define instsize(l) ((int)(((l) + (uint)sizeof(Instruction) - 1u) \ |
133 | / (unsigned int)sizeof(Instruction))) | 135 | / (uint)sizeof(Instruction))) |
134 | 136 | ||
135 | 137 | ||
136 | /* size (in elements) for a ISet instruction */ | 138 | /* size (in elements) for a ISet instruction */ |
@@ -141,7 +143,7 @@ typedef struct Charset { | |||
141 | 143 | ||
142 | 144 | ||
143 | 145 | ||
144 | #define testchar(st,c) ((((unsigned int)(st)[((c) >> 3)]) >> ((c) & 7)) & 1) | 146 | #define testchar(st,c) ((((uint)(st)[((c) >> 3)]) >> ((c) & 7)) & 1) |
145 | 147 | ||
146 | 148 | ||
147 | #endif | 149 | #endif |