forked from jfmrod/hpc-clust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake-lookuptables.cpp
70 lines (61 loc) · 1.88 KB
/
make-lookuptables.cpp
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <eutils/emain.h>
#include <eutils/efile.h>
void gap_writeLookupTable(const estr& file);
void nogap_writeLookupTable(const estr& file,const estr& file2);
#define lt_gap_init(i,j,lt_count,mask) { if ((i&mask)==(j&mask)) ++lt_count[i^j]; }
#define lt_nogap_init(i,j,lt_len,lt_count,mask) \
{ \
if ((j&i&mask)==mask) \
++lt_len[i&j]; \
if ((i&mask)==(j&mask)) \
++lt_count[i^j]; \
}
void gap_writeLookupTable(const estr& fnm)
{
char tmplt_gap_count[0x1u << 16];
unsigned int i,j;
for (i=0u; i<0x1u<<16; ++i){
for (j=0u; j<=i; ++j){
tmplt_gap_count[i^j]=0;
lt_gap_init(i,j,tmplt_gap_count,0xfu);
lt_gap_init(i,j,tmplt_gap_count,0xf0u);
lt_gap_init(i,j,tmplt_gap_count,0xf00u);
lt_gap_init(i,j,tmplt_gap_count,0xf000u);
}
}
efile f(fnm);
for (i=0u; i<0x1u<<16; ++i)
f.write(tmplt_gap_count[i]);
f.close();
}
void nogap_writeLookupTable(const estr& fnm,const estr& fnm2)
{
char tmplt_nogap_len[0x1u<<16];
char tmplt_nogap_count[0x1u<<16];
unsigned int i,j;
for (i=0u; i<0x1u<<16; ++i){
for (j=0u; j<=i; ++j){
tmplt_nogap_len[i&j]=0;
tmplt_nogap_count[i^j]=0;
lt_nogap_init(i,j,tmplt_nogap_len,tmplt_nogap_count,0xfu);
lt_nogap_init(i,j,tmplt_nogap_len,tmplt_nogap_count,0xf0u);
lt_nogap_init(i,j,tmplt_nogap_len,tmplt_nogap_count,0xf00u);
lt_nogap_init(i,j,tmplt_nogap_len,tmplt_nogap_count,0xf000u);
}
}
efile f;
f.open(fnm,"w");
for (i=0u; i<0x1u<<16; ++i)
f.write(tmplt_nogap_count[i]);
f.close();
f.open(fnm2,"w");
for (i=0u; i<0x1u<<16; ++i)
f.write(tmplt_nogap_len[i]);
f.close();
}
int emain()
{
gap_writeLookupTable("lt_gap_count");
nogap_writeLookupTable("lt_nogap_count","lt_nogap_len");
return(0);
}