commit e89763e9640bf08982ac67888ea6474f1eeccd7c parent be63d995c102d02b7d5f3457b1cb6dc2aca7a406 Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br> Date: Fri, 26 Jun 2015 16:31:42 -0300 simpler code for 'luaO_fb2int' Diffstat:
M | lobject.c | | | 6 | ++---- |
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/lobject.c b/lobject.c @@ -1,5 +1,5 @@ /* -** $Id: lobject.c,v 2.104 2015/04/11 18:30:08 roberto Exp roberto $ +** $Id: lobject.c,v 2.105 2015/06/18 14:26:05 roberto Exp roberto $ ** Some generic functions over Lua objects ** See Copyright Notice in lua.h */ @@ -55,9 +55,7 @@ int luaO_int2fb (unsigned int x) { /* converts back */ int luaO_fb2int (int x) { - int e = (x >> 3) & 0x1f; - if (e == 0) return x; - else return ((x & 7) + 8) << (e - 1); + return (x < 8) ? x : ((x & 7) + 8) << ((x >> 3) - 1); }