aboutsummaryrefslogtreecommitdiff
path: root/ltable.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-01-29 15:17:26 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-01-29 15:17:26 -0200
commit6b71a9cfe53040aa605f5d75c58a2124d03f8912 (patch)
treeadbd5eb607941b3fbf2eb36359b15841de4159ae /ltable.h
parentfa8c44b510c6b56a290c14bd5dba4c7caec53284 (diff)
downloadlua-6b71a9cfe53040aa605f5d75c58a2124d03f8912.tar.gz
lua-6b71a9cfe53040aa605f5d75c58a2124d03f8912.tar.bz2
lua-6b71a9cfe53040aa605f5d75c58a2124d03f8912.zip
smaller tables for machines with 8-bit alignment
Diffstat (limited to 'ltable.h')
-rw-r--r--ltable.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/ltable.h b/ltable.h
index cbdcf743..3757bd01 100644
--- a/ltable.h
+++ b/ltable.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.h,v 1.29 2001/01/26 14:16:35 roberto Exp roberto $ 2** $Id: ltable.h,v 1.30 2001/01/29 13:02:20 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*/
@@ -10,13 +10,20 @@
10#include "lobject.h" 10#include "lobject.h"
11 11
12 12
13#define node(t,i) (&(t)->node[i]) 13#define node(_t,_i) (&(_t)->node[_i])
14#define key(n) (&(n)->key) 14#define val(_n) (&(_n)->val)
15#define val(n) (&(n)->val)
16 15
17#define luaH_get(t,k) luaH_set(NULL,t,k) 16#define ttype_key(_n) ((_n)->key_tt)
18#define luaH_getnum(t,k) luaH_setnum(NULL,t,k) 17#define nvalue_key(_n) ((_n)->key_value.n)
19#define luaH_getstr(t,k) luaH_setstr(NULL,t,k) 18#define tsvalue_key(_n) ((TString *)(_n)->key_value.v)
19#define setkey2obj(_o,_k) \
20 ((_o)->tt = ttype_key(_k), (_o)->value = (_k)->key_value)
21#define setobj2key(_k,_o) \
22 (ttype_key(_k) = (_o)->tt, (_k)->key_value = (_o)->value)
23
24#define luaH_get(_t,_k) luaH_set(NULL,_t,_k)
25#define luaH_getnum(_t,_k) luaH_setnum(NULL,_t,_k)
26#define luaH_getstr(_t,_k) luaH_setstr(NULL,_t,_k)
20 27
21Hash *luaH_new (lua_State *L, int nhash); 28Hash *luaH_new (lua_State *L, int nhash);
22void luaH_free (lua_State *L, Hash *t); 29void luaH_free (lua_State *L, Hash *t);
@@ -27,7 +34,7 @@ TObject *luaH_setnum (lua_State *L, Hash *t, lua_Number key);
27TObject *luaH_setstr (lua_State *L, Hash *t, TString *key); 34TObject *luaH_setstr (lua_State *L, Hash *t, TString *key);
28 35
29/* exported only for debugging */ 36/* exported only for debugging */
30Node *luaH_mainposition (const Hash *t, const TObject *key); 37Node *luaH_mainposition (const Hash *t, const Node *n);
31 38
32 39
33#endif 40#endif