diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-01-26 13:58:50 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-01-26 13:58:50 -0200 |
| commit | b82242d4c493191d543fe5784b4d884e0cba9809 (patch) | |
| tree | 0f006771a6b86fd5501f21085dc60a643ca1ea08 | |
| parent | ac390020e91e14f00200ad3df97682b715d3e59b (diff) | |
| download | lua-b82242d4c493191d543fe5784b4d884e0cba9809.tar.gz lua-b82242d4c493191d543fe5784b4d884e0cba9809.tar.bz2 lua-b82242d4c493191d543fe5784b4d884e0cba9809.zip | |
detail
| -rw-r--r-- | lobject.h | 7 | ||||
| -rw-r--r-- | lstring.c | 4 | ||||
| -rw-r--r-- | ltable.c | 8 |
3 files changed, 11 insertions, 8 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.h,v 1.87 2001/01/19 13:20:30 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 1.88 2001/01/25 16:45:36 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 | */ |
| @@ -200,6 +200,11 @@ typedef struct Hash { | |||
| 200 | 200 | ||
| 201 | 201 | ||
| 202 | /* | 202 | /* |
| 203 | ** "module" operation (size is always a power of 2) */ | ||
| 204 | #define lmod(s,size) ((int)((s) & ((size)-1))) | ||
| 205 | |||
| 206 | |||
| 207 | /* | ||
| 203 | ** informations about a call (for debugging) | 208 | ** informations about a call (for debugging) |
| 204 | */ | 209 | */ |
| 205 | typedef struct CallInfo { | 210 | typedef struct CallInfo { |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstring.c,v 1.50 2001/01/11 18:59:20 roberto Exp roberto $ | 2 | ** $Id: lstring.c,v 1.51 2001/01/19 13:20:30 roberto Exp roberto $ |
| 3 | ** String table (keeps all strings handled by Lua) | 3 | ** String table (keeps all strings handled by Lua) |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -15,8 +15,6 @@ | |||
| 15 | #include "lstring.h" | 15 | #include "lstring.h" |
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | #define lmod(s,size) ((int)((s) & ((size)-1))) | ||
| 19 | |||
| 20 | 18 | ||
| 21 | void luaS_init (lua_State *L) { | 19 | void luaS_init (lua_State *L) { |
| 22 | luaS_resize(L, &G(L)->strt, MINPOWER2); | 20 | luaS_resize(L, &G(L)->strt, MINPOWER2); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltable.c,v 1.68 2001/01/26 13:18:00 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 1.69 2001/01/26 14:16:35 roberto Exp roberto $ |
| 3 | ** Lua tables (hash) | 3 | ** Lua tables (hash) |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -31,9 +31,9 @@ | |||
| 31 | #define TagDefault LUA_TTABLE | 31 | #define TagDefault LUA_TTABLE |
| 32 | 32 | ||
| 33 | 33 | ||
| 34 | #define hashnum(t,n) (&t->node[(luint32)(lint32)(n)&(t->size-1)]) | 34 | #define hashnum(t,n) (&t->node[lmod((luint32)(lint32)(n), t->size)]) |
| 35 | #define hashstr(t,str) (&t->node[(str)->u.s.hash&(t->size-1)]) | 35 | #define hashstr(t,str) (&t->node[lmod((str)->u.s.hash, t->size)]) |
| 36 | #define hashpointer(t,p) (&t->node[IntPoint(p)&(t->size-1)]) | 36 | #define hashpointer(t,p) (&t->node[lmod(IntPoint(p), t->size)]) |
| 37 | 37 | ||
| 38 | 38 | ||
| 39 | /* | 39 | /* |
