/usr/include/pbseq/pbdata/Compare4BitCompressed.hpp is in libpbdata-dev 0~20161219-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 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | /*
* ============================================================================
*
* Filename: Compare4BitCompressed.h
*
* Description: Imported from BLASR algorithm/compare
*
* Version: 1.0
* Created: 12/19/2013 05:22:46 PM
* Revision: none
* Compiler: gcc
*
* Author: Yuan Li (yli), yli@pacificbiosciences.com
* Company: Pacific Biosciences
*
* ============================================================================
*/
#ifndef _BLASR_COMPARE_4BIT_COMPRESSED_HPP_
#define _BLASR_COMPARE_4BIT_COMPRESSED_HPP_
#include "defs.h"
template<typename TNuc>
class Compare4BitCompressed {
public:
const static unsigned char MaskCount = 0xf;
static int Compare(TNuc *lhs, TNuc *rhs) {
return ThreeBit[*lhs & MaskCount] - ThreeBit[*rhs & MaskCount];
}
static int Compare(TNuc *lhs, TNuc *rhs, int length) {
int i;
int res;
i = 0;
TNuc *lhsptr;
TNuc *rhsptr;
lhsptr = lhs;
rhsptr = rhs;
char *lhsend = lhs + length;
res = 0;
while (lhsptr != lhsend and res == 0) {
res = ThreeBit[*lhsptr & MaskCount] - ThreeBit[*rhsptr & MaskCount];
++lhsptr;
++rhsptr;
}
return res;
}
static int Equal(TNuc a, TNuc b) {
return (a & MaskCount) == (b & MaskCount);
}
static int LessThan(TNuc *a, int aLen, TNuc *b, int bLen) {
int minabLen = MIN(aLen, bLen);
if (minabLen <= 0)
return 0;
// int cmpRes;
int cmpRes = Compare(a, b, minabLen);
if (cmpRes < 0) {
return 1;
}
else {
return 0;
}
}
static int LessThanEqual(TNuc *a, int aLen, TNuc *b, int bLen) {
int minabLen = MIN(aLen, bLen);
if (minabLen <= 0)
return 1;
int cmpRes = Compare(a, b, minabLen);
if (cmpRes <= 0) {
return 1;
}
else {
return 0;
}
}
static int Equals(TNuc *a, int aLen, TNuc *b, int bLen) {
int minabLen = MIN(aLen, bLen);
if (minabLen < 0)
return 0;
if (minabLen == 0)
return 1;
int cmpRes = Compare(a, b, minabLen);
if (cmpRes == 0 and aLen <= bLen) {
return 1;
}
else {
return 0;
}
}
};
#endif
|