Skip to content

Commit

Permalink
Merge pull request #80 from markcjeffrey/add-h3-destructor
Browse files Browse the repository at this point in the history
[hash] Add destructor to H3HashFamily
  • Loading branch information
s5z committed Feb 20, 2016
2 parents 21a03d4 + ae7139b commit c80ca25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/hash.cpp
Expand Up @@ -61,6 +61,10 @@ H3HashFamily::H3HashFamily(uint32_t numFunctions, uint32_t outputBits, uint64_t
}
}

H3HashFamily::~H3HashFamily() {
gm_free(hMatrix);
}

/* NOTE: This is fairly well hand-optimized. Go to the commit logs to see the speedup of this function. Main things:
* 1. resShift indicates how many bits of output are computed (64, 32, 16, or 8). With less than 64 bits, several rounds are folded at the end.
* 2. The output folding does not mask, the output is expected to be masked by caller.
Expand Down
3 changes: 2 additions & 1 deletion src/hash.h
Expand Up @@ -39,11 +39,12 @@ class HashFamily : public GlobAlloc {

class H3HashFamily : public HashFamily {
private:
uint32_t numFuncs;
const uint32_t numFuncs;
uint32_t resShift;
uint64_t* hMatrix;
public:
H3HashFamily(uint32_t numFunctions, uint32_t outputBits, uint64_t randSeed = 123132127);
virtual ~H3HashFamily();
uint64_t hash(uint32_t id, uint64_t val);
};

Expand Down

0 comments on commit c80ca25

Please sign in to comment.