blob: a20c56f761b3c627a1710373689fe358a3de64f2 (
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
28
|
#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("int (*return_fn())(const char * )mer_ptr(int kmer) { switch(kmer) {");
for(j = 1; j < 32; j++)
printf("case %d: return mer_%d;", j, j);
printf("}");
}
|