aboutsummaryrefslogtreecommitdiff
path: root/lobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'lobject.c')
-rw-r--r--lobject.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lobject.c b/lobject.c
index a7ee87a6..2d8475b3 100644
--- a/lobject.c
+++ b/lobject.c
@@ -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*/
35int luaO_int2fb (unsigned int x) { 35int 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 */
47int luaO_fb2int (int x) { 47int 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