/usr/include/blasr/algorithms/compare/CompareStrings.hpp is in libblasr-dev 0~20151014+gitbe5d1bf-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 71 72 73 74 75 76 77 78 79 80 81 | #ifndef _BLASR_COMPARE_STRINGS_HPP_
#define _BLASR_COMPARE_STRINGS_HPP_
template<typename T>
class DefaultCompareStrings {
public:
static int Compare(T lhs, T rhs) {
return ThreeBit[lhs] - ThreeBit[rhs];
}
static int Compare(T *lhs, T *rhs, int length) {
int i;
int res;
i = 0;
T *lhsptr;
T *rhsptr;
lhsptr = lhs;
rhsptr = rhs;
char *lhsend = lhs + length;
res = 0;
while (lhsptr != lhsend and res == 0) {
res = ThreeBit[*lhsptr] - ThreeBit[*rhsptr];
++lhsptr;
++rhsptr;
}
return res;
}
static int Equal(T a, T b) {
//
// Compare single characters.
//
return a == b;
}
static int LessThan(T *a, int aLen, T *b, int bLen) {
int minabLen = MIN(aLen, bLen);
if (minabLen <= 0)
return 0;
int cmpRes = memcmp((void*) a, (void*) b, minabLen);
if (cmpRes < 0) {
return 1;
}
else {
return 0;
}
}
static int LessThanEqual(T *a, int aLen, T *b, int bLen) {
int minabLen = MIN(aLen, bLen);
if (minabLen <= 0)
return 1;
int cmpRes = memcmp((void*) a, (void*)b, minabLen);
if (cmpRes <= 0) {
return 1;
}
else {
return 0;
}
}
static int Equal(T* a, int aLen, T *b, int bLen) {
int minabLen = MIN(aLen, bLen);
if (minabLen < 0)
return 0;
if (minabLen == 0)
return 1;
int cmpRes = memcmp((void*) a, (void*)b, minabLen);
if (cmpRes == 0 and aLen <= bLen) {
return 1;
}
else {
return 0;
}
}
};
#endif // _BLASR_COMPARE_STRINGS_HPP_
|