diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-06-26 16:32:07 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-06-26 16:32:07 -0300 |
| commit | e89763e9640bf08982ac67888ea6474f1eeccd7c (patch) | |
| tree | 13eb54dba77b74ae72a8b8101ae0e2659361ffa3 | |
| parent | be63d995c102d02b7d5f3457b1cb6dc2aca7a406 (diff) | |
| download | lua-e89763e9640bf08982ac67888ea6474f1eeccd7c.tar.gz lua-e89763e9640bf08982ac67888ea6474f1eeccd7c.tar.bz2 lua-e89763e9640bf08982ac67888ea6474f1eeccd7c.zip | |
simpler code for 'luaO_fb2int'
| -rw-r--r-- | lobject.c | 6 |
1 files changed, 2 insertions, 4 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.c,v 2.104 2015/04/11 18:30:08 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 2.105 2015/06/18 14:26:05 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 | */ |
| @@ -55,9 +55,7 @@ int luaO_int2fb (unsigned int x) { | |||
| 55 | 55 | ||
| 56 | /* converts back */ | 56 | /* converts back */ |
| 57 | int luaO_fb2int (int x) { | 57 | int luaO_fb2int (int x) { |
| 58 | int e = (x >> 3) & 0x1f; | 58 | return (x < 8) ? x : ((x & 7) + 8) << ((x >> 3) - 1); |
| 59 | if (e == 0) return x; | ||
| 60 | else return ((x & 7) + 8) << (e - 1); | ||
| 61 | } | 59 | } |
| 62 | 60 | ||
| 63 | 61 | ||
