File size: 495 Bytes
37a92a9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python

import math

radix = 8
scale = 1<<radix

byx = 1.
logtab = []
while True:
    lobyx = math.log(1. + byx)
    k = int(round(lobyx * scale))
    logtab.append(k)
    if k == 0:
        break
    byx *= math.exp(-1./scale)

print "static const unsigned char logadd_table[] = {"
for i in range(0,len(logtab),10):
    if i+10 <= len(logtab):
        print ", ".join(str(x) for x in logtab[i:i+10]) + ","
    else:
        print ", ".join(str(x) for x in logtab[i:])
print "};"