diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-11-26 16:59:20 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-11-26 16:59:20 -0200 |
| commit | d015f1fc02e03864b0ed3ad668a6e0660417a718 (patch) | |
| tree | 00b5962e40540bbb8a71bf8665fed256182aa6c7 /lobject.h | |
| parent | 790690a2236ab0ad0cce35551c17e62064b4c85b (diff) | |
| download | lua-d015f1fc02e03864b0ed3ad668a6e0660417a718.tar.gz lua-d015f1fc02e03864b0ed3ad668a6e0660417a718.tar.bz2 lua-d015f1fc02e03864b0ed3ad668a6e0660417a718.zip | |
table sizes don't need to be primes; power of 2 gives the same performance.
Diffstat (limited to 'lobject.h')
| -rw-r--r-- | lobject.h | 9 |
1 files changed, 6 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.h,v 1.36 1999/11/10 15:39:35 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 1.37 1999/11/22 13:12:07 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 | */ |
| @@ -45,7 +45,8 @@ typedef unsigned char Byte; /* unsigned 8 bits */ | |||
| 45 | 45 | ||
| 46 | 46 | ||
| 47 | /* convertion of pointer to int (for hashing only) */ | 47 | /* convertion of pointer to int (for hashing only) */ |
| 48 | #define IntPoint(L, p) ((unsigned int)(p)) | 48 | /* (the shift removes bits that are usually 0 because of alignment) */ |
| 49 | #define IntPoint(L, p) (((unsigned int)(p)) >> 3) | ||
| 49 | 50 | ||
| 50 | 51 | ||
| 51 | /* | 52 | /* |
| @@ -194,9 +195,11 @@ typedef struct Hash { | |||
| 194 | 195 | ||
| 195 | extern const char *const luaO_typenames[]; | 196 | extern const char *const luaO_typenames[]; |
| 196 | 197 | ||
| 197 | |||
| 198 | #define luaO_typename(L, o) luaO_typenames[-ttype(o)] | 198 | #define luaO_typename(L, o) luaO_typenames[-ttype(o)] |
| 199 | 199 | ||
| 200 | #define MINPOWER2 4 /* minimum size for "growing" vectors */ | ||
| 201 | |||
| 202 | unsigned long luaO_power2 (unsigned long n); | ||
| 200 | 203 | ||
| 201 | extern const TObject luaO_nilobject; | 204 | extern const TObject luaO_nilobject; |
| 202 | 205 | ||
