blob: 33f285a0dbdf2c16d7fad561b4a5b8508e5a86a6 (
plain)
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
|
#include "stdio.h"
#include "limits.h"
#include "kmer_utils.h"
main() {
int i = 0;
int j = 0;
unsigned long out = 0;
for(j = 1; j < 32; j++) {
printf("unsigned long long mer_%d(const char *seq) { return ", j);
unsigned long multiply = 1;
for(i = j - 1; i >= 0; i--){
printf("(seq[%d] * %d) + ", i, multiply);
multiply = multiply << 2;
}
printf(" 0; }\n");
}
printf("typedef unsigned long long (*merptr_t)(const char *);\n");
printf("merptr_t get_ptr(int kmer) { switch(kmer) {");
for(j = 1; j < 32; j++)
printf("case %d: return mer_%d;\n", j, j);
printf("}\n");
}
|