aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kmer_utils.c14
-rw-r--r--kmer_utils.h15
2 files changed, 27 insertions, 2 deletions
diff --git a/kmer_utils.c b/kmer_utils.c
index 8f2f324..b96f831 100644
--- a/kmer_utils.c
+++ b/kmer_utils.c
@@ -8,7 +8,19 @@
using namespace std;
-typedef unordered_map<size_t,unsigned long long> kmer_map;
+typedef struct {
+ size_t operator() (const size_t &k) const {
+ return k;
+ }
+} kmer_noHash_hash;
+
+typedef struct {
+ bool operator() (const size_t &x, const size_t &y) const {
+ return x == y;
+ }
+} kmer_eq;
+
+typedef unordered_map<size_t, unsigned long long, kmer_noHash_hash, kmer_eq> kmer_map;
const unsigned char alpha[256] =
{5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
diff --git a/kmer_utils.h b/kmer_utils.h
index 10d7ea4..a9d9a1d 100644
--- a/kmer_utils.h
+++ b/kmer_utils.h
@@ -11,7 +11,20 @@ size_t strnstrip(char *s, int c, size_t len);
unsigned long long pow_four(unsigned long long x);
// Variables
-typedef unordered_map<size_t,unsigned long long> kmer_map;
+typedef struct {
+ size_t operator() (const size_t &k) const {
+ return k;
+ }
+} kmer_noHash_hash;
+
+typedef struct {
+ bool operator() (const size_t &x, const size_t &y) const {
+ return x == y;
+ }
+} kmer_eq;
+
+typedef unordered_map<size_t,unsigned long long, kmer_noHash_hash, kmer_eq> kmer_map;
+
unsigned char alpha[256];
// file loading functions
kmer_map *get_sparse_kmer_counts_from_filename(const char *fn, const unsigned int kmer);