Last change
on this file was
11060,
checked in by westram, 11 years ago
|
- reintegrates 'ptsfix' into 'trunk':
- adds:
- log:branches/ptsdump@8966:9000
- log:branches/ptsfix@8965:9012,9014:9017,9019:9023,9025:9046,9048:9089,9091:9114,9116:9132,9134:9139,9141:9145,9147:9151,9153:9158,9160:9379,9381:11059
- log:branches/ptsstartup@9160:9235,9237:9278,9280:9336,9339:9361,9363:9446
- log:branches/ptsundef@9061:9358
|
File size:
1.4 KB
|
Line | |
---|
1 | // =============================================================== // |
---|
2 | // // |
---|
3 | // File : PT_complement.h // |
---|
4 | // Purpose : // |
---|
5 | // // |
---|
6 | // Coded by Ralf Westram (coder@reallysoft.de) in January 2013 // |
---|
7 | // Institute of Microbiology (Technical University Munich) // |
---|
8 | // http://www.arb-home.de/ // |
---|
9 | // // |
---|
10 | // =============================================================== // |
---|
11 | |
---|
12 | #ifndef PT_COMPLEMENT_H |
---|
13 | #define PT_COMPLEMENT_H |
---|
14 | |
---|
15 | #ifndef PT_PROTOTYPES_H |
---|
16 | #include "pt_prototypes.h" |
---|
17 | #endif |
---|
18 | |
---|
19 | class Complement { |
---|
20 | int complement[256]; |
---|
21 | |
---|
22 | static int calc_complement(int base); // DO NOT INLINE! (workaround a gcc-4.4.3-bug; see [9355] for details) |
---|
23 | |
---|
24 | public: |
---|
25 | Complement() { for (int i = 0; i<256; ++i) complement[i] = calc_complement(i); } |
---|
26 | int get(int base) const { return complement[base]; } |
---|
27 | }; |
---|
28 | |
---|
29 | inline int get_complement(int base) { |
---|
30 | static Complement c; |
---|
31 | pt_assert(base >= 0 && base <= 255); |
---|
32 | return c.get(base); |
---|
33 | } |
---|
34 | |
---|
35 | inline void complement_probe(char *Probe, int len) { |
---|
36 | for (int i = 0; i<len; i++) { |
---|
37 | Probe[i] = get_complement(Probe[i]); |
---|
38 | } |
---|
39 | } |
---|
40 | |
---|
41 | #else |
---|
42 | #error PT_complement.h included twice |
---|
43 | #endif // PT_COMPLEMENT_H |
---|
Note: See
TracBrowser
for help on using the repository browser.