get num of factors from bjam arg like the rest of moses

This commit is contained in:
Hieu Hoang 2015-10-26 13:33:17 +00:00
parent e2bb633632
commit 75c052dc66
3 changed files with 5 additions and 5 deletions

View File

@ -9,7 +9,7 @@
#include <cstddef> #include <cstddef>
typedef float SCORE; typedef float SCORE;
const size_t NUM_FACTOR = 4;

View File

@ -10,7 +10,7 @@
#include "util/murmur_hash.hh" #include "util/murmur_hash.hh"
Word::Word() { Word::Word() {
Init<Factor*>(m_factors, NUM_FACTOR, NULL); Init<Factor*>(m_factors, MAX_NUM_FACTORS, NULL);
} }
Word::~Word() { Word::~Word() {
@ -20,12 +20,12 @@ Word::~Word() {
size_t Word::hash() const size_t Word::hash() const
{ {
uint64_t seed = 0; uint64_t seed = 0;
size_t ret = util::MurmurHashNative(m_factors, sizeof(Factor*) * NUM_FACTOR, seed); size_t ret = util::MurmurHashNative(m_factors, sizeof(Factor*) * MAX_NUM_FACTORS, seed);
return ret; return ret;
} }
bool Word::operator==(const Word &compare) const bool Word::operator==(const Word &compare) const
{ {
int cmp = memcmp(m_factors, compare.m_factors, sizeof(Factor*) * NUM_FACTOR); int cmp = memcmp(m_factors, compare.m_factors, sizeof(Factor*) * MAX_NUM_FACTORS);
return cmp == 0; return cmp == 0;
} }

View File

@ -19,6 +19,6 @@ public:
bool operator==(const Word &compare) const; bool operator==(const Word &compare) const;
protected: protected:
Factor *m_factors[NUM_FACTOR]; Factor *m_factors[MAX_NUM_FACTORS];
}; };