aboutsummaryrefslogtreecommitdiff
path: root/lobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'lobject.c')
-rw-r--r--lobject.c26
1 files changed, 0 insertions, 26 deletions
diff --git a/lobject.c b/lobject.c
index 2c265f96..b4efae4f 100644
--- a/lobject.c
+++ b/lobject.c
@@ -30,32 +30,6 @@
30 30
31 31
32/* 32/*
33** converts an integer to a "floating point byte", represented as
34** (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if
35** eeeee != 0 and (xxx) otherwise.
36*/
37int luaO_int2fb (unsigned int x) {
38 int e = 0; /* exponent */
39 if (x < 8) return x;
40 while (x >= (8 << 4)) { /* coarse steps */
41 x = (x + 0xf) >> 4; /* x = ceil(x / 16) */
42 e += 4;
43 }
44 while (x >= (8 << 1)) { /* fine steps */
45 x = (x + 1) >> 1; /* x = ceil(x / 2) */
46 e++;
47 }
48 return ((e+1) << 3) | (cast_int(x) - 8);
49}
50
51
52/* converts back */
53int luaO_fb2int (int x) {
54 return (x < 8) ? x : ((x & 7) + 8) << ((x >> 3) - 1);
55}
56
57
58/*
59** Computes ceil(log2(x)) 33** Computes ceil(log2(x))
60*/ 34*/
61int luaO_ceillog2 (unsigned int x) { 35int luaO_ceillog2 (unsigned int x) {