diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-01-10 10:51:53 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-01-10 10:51:53 -0200 |
commit | ffb798e1e2deb1fe0f931e1f6c5b6d91f694051c (patch) | |
tree | 325354bd5b01893821ae7aed0bab0409027ef431 /lobject.h | |
parent | fa936f8fa9d391de08901339de044b783011adfa (diff) | |
download | lua-ffb798e1e2deb1fe0f931e1f6c5b6d91f694051c.tar.gz lua-ffb798e1e2deb1fe0f931e1f6c5b6d91f694051c.tar.bz2 lua-ffb798e1e2deb1fe0f931e1f6c5b6d91f694051c.zip |
avoids type punning for table keys
Diffstat (limited to '')
-rw-r--r-- | lobject.h | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.h,v 2.17 2005/06/13 14:19:00 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 2.18 2005/10/24 17:37:33 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 | */ |
@@ -323,9 +323,12 @@ typedef union Closure { | |||
323 | ** Tables | 323 | ** Tables |
324 | */ | 324 | */ |
325 | 325 | ||
326 | typedef struct TKey { | 326 | typedef union TKey { |
327 | TValuefields; | 327 | struct { |
328 | struct Node *next; /* for chaining */ | 328 | TValuefields; |
329 | struct Node *next; /* for chaining */ | ||
330 | } nk; | ||
331 | TValue tvk; | ||
329 | } TKey; | 332 | } TKey; |
330 | 333 | ||
331 | 334 | ||
@@ -360,8 +363,9 @@ typedef struct Table { | |||
360 | #define sizenode(t) (twoto((t)->lsizenode)) | 363 | #define sizenode(t) (twoto((t)->lsizenode)) |
361 | 364 | ||
362 | 365 | ||
366 | #define luaO_nilobject (&luaO_nilobject_) | ||
363 | 367 | ||
364 | LUAI_DATA const TValue luaO_nilobject; | 368 | LUAI_DATA const TValue luaO_nilobject_; |
365 | 369 | ||
366 | #define ceillog2(x) (luaO_log2((x)-1) + 1) | 370 | #define ceillog2(x) (luaO_log2((x)-1) + 1) |
367 | 371 | ||