diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-07-11 12:53:29 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-07-11 12:53:29 -0300 |
| commit | 3ca9af51a4f060cf2178901a67a21f8269af3224 (patch) | |
| tree | 4f1bb541280aa8b4960b16d0925eca60adb2b1a8 /lobject.c | |
| parent | c7b89dd28097296bbc14d9b47b4cea72514b2b76 (diff) | |
| download | lua-3ca9af51a4f060cf2178901a67a21f8269af3224.tar.gz lua-3ca9af51a4f060cf2178901a67a21f8269af3224.tar.bz2 lua-3ca9af51a4f060cf2178901a67a21f8269af3224.zip | |
emergency garbage collector (core forces a GC when allocation fails)
Diffstat (limited to 'lobject.c')
| -rw-r--r-- | lobject.c | 12 |
1 files changed, 6 insertions, 6 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.c,v 2.21 2006/01/10 12:50:00 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 2.22 2006/02/10 17:43:52 roberto Exp roberto $ |
| 3 | ** Some generic functions over Lua objects | 3 | ** Some generic functions over Lua objects |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -34,20 +34,20 @@ const TValue luaO_nilobject_ = {{NULL}, LUA_TNIL}; | |||
| 34 | */ | 34 | */ |
| 35 | int luaO_int2fb (unsigned int x) { | 35 | int luaO_int2fb (unsigned int x) { |
| 36 | int e = 0; /* expoent */ | 36 | int e = 0; /* expoent */ |
| 37 | while (x >= 16) { | 37 | if (x < 8) return x; |
| 38 | while (x >= 0x10) { | ||
| 38 | x = (x+1) >> 1; | 39 | x = (x+1) >> 1; |
| 39 | e++; | 40 | e++; |
| 40 | } | 41 | } |
| 41 | if (x < 8) return x; | 42 | return ((e+1) << 3) | (cast_int(x) - 8); |
| 42 | else return ((e+1) << 3) | (cast_int(x) - 8); | ||
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | 45 | ||
| 46 | /* converts back */ | 46 | /* converts back */ |
| 47 | int luaO_fb2int (int x) { | 47 | int luaO_fb2int (int x) { |
| 48 | int e = (x >> 3) & 31; | 48 | int e = (x >> 3) & 0x1f; |
| 49 | if (e == 0) return x; | 49 | if (e == 0) return x; |
| 50 | else return ((x & 7)+8) << (e - 1); | 50 | else return ((x & 7) + 8) << (e - 1); |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | 53 | ||
