mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-11-09 16:04:41 +03:00
Fix compilation errors on clang.
Clang does not like default args allowed in template function definitions. See e.g., http://www.mail-archive.com/llvmbugs@cs.uiuc.edu/msg08284.html
This commit is contained in:
parent
2e7e28092c
commit
0c552e5be1
@ -138,7 +138,7 @@ void Hash_shiftAddXOR<T>::initSeeds() {
|
|||||||
v_[i] = Utils::rand<T>() + 1;
|
v_[i] = Utils::rand<T>() + 1;
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T Hash_shiftAddXOR<T>::hash(const char* s, count_t h=0) {
|
T Hash_shiftAddXOR<T>::hash(const char* s, count_t h) {
|
||||||
T value = v_[h];
|
T value = v_[h];
|
||||||
int pos(0);
|
int pos(0);
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
@ -171,7 +171,7 @@ void UnivHash_tableXOR<T>::freeSeeds() {
|
|||||||
table_ = NULL;
|
table_ = NULL;
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T UnivHash_tableXOR<T>::hash(const char* s, count_t h = 0) {
|
T UnivHash_tableXOR<T>::hash(const char* s, count_t h) {
|
||||||
T value = 0;
|
T value = 0;
|
||||||
count_t pos = 0, idx = 0;
|
count_t pos = 0, idx = 0;
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
@ -191,14 +191,14 @@ void UnivHash_noPrimes<T>::initSeeds() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T UnivHash_noPrimes<T>::hash(const P x, count_t h=0) {
|
T UnivHash_noPrimes<T>::hash(const P x, count_t h) {
|
||||||
// h_a(x) = (ax mod 2^l) div 2^(l-k)
|
// h_a(x) = (ax mod 2^l) div 2^(l-k)
|
||||||
T value = ((a_[h] * x) % p_) >> d_;
|
T value = ((a_[h] * x) % p_) >> d_;
|
||||||
return value % this->m_;
|
return value % this->m_;
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T UnivHash_noPrimes<T>::hash(const wordID_t* id, const int len,
|
T UnivHash_noPrimes<T>::hash(const wordID_t* id, const int len,
|
||||||
count_t h=0) {
|
count_t h) {
|
||||||
T value = 0;
|
T value = 0;
|
||||||
int pos(0);
|
int pos(0);
|
||||||
while(pos < len) {
|
while(pos < len) {
|
||||||
@ -208,7 +208,7 @@ T UnivHash_noPrimes<T>::hash(const wordID_t* id, const int len,
|
|||||||
return value % this->m_;
|
return value % this->m_;
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T UnivHash_noPrimes<T>::hash(const char* s, count_t h=0) {
|
T UnivHash_noPrimes<T>::hash(const char* s, count_t h) {
|
||||||
T value = 0;
|
T value = 0;
|
||||||
int pos(0);
|
int pos(0);
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
@ -264,7 +264,7 @@ void UnivHash_linear<T>::freeSeeds() {
|
|||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T UnivHash_linear<T>::hash(const wordID_t* id, const int len,
|
inline T UnivHash_linear<T>::hash(const wordID_t* id, const int len,
|
||||||
count_t h=0) {
|
count_t h) {
|
||||||
CHECK(h < this->H_);
|
CHECK(h < this->H_);
|
||||||
T value = 0;
|
T value = 0;
|
||||||
int pos(0);
|
int pos(0);
|
||||||
@ -276,7 +276,7 @@ inline T UnivHash_linear<T>::hash(const wordID_t* id, const int len,
|
|||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T UnivHash_linear<T>::hash(const wordID_t id, const count_t pos,
|
inline T UnivHash_linear<T>::hash(const wordID_t id, const count_t pos,
|
||||||
const T prevValue, count_t h=0) {
|
const T prevValue, count_t h) {
|
||||||
CHECK(h < this->H_);
|
CHECK(h < this->H_);
|
||||||
T value = prevValue + ((a_[h][pos] * id) + b_[h][pos]); // % pr_;
|
T value = prevValue + ((a_[h][pos] * id) + b_[h][pos]); // % pr_;
|
||||||
return value % this->m_;
|
return value % this->m_;
|
||||||
|
@ -97,7 +97,7 @@ PerfectHash<T>::~PerfectHash() {
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
uint64_t PerfectHash<T>::insert(const wordID_t* IDs, const int len,
|
uint64_t PerfectHash<T>::insert(const wordID_t* IDs, const int len,
|
||||||
const count_t value) {
|
const count_t value) {
|
||||||
count_t bucket = (bucketHash_->size() > 1 ? bucketHash_->hash(IDs, len, len) : bucketHash_->hash(IDs, len));
|
count_t bucket = (bucketHash_->size() > 1 ? bucketHash_->hash(IDs, len, len) : bucketHash_->hash(IDs, len, 0));
|
||||||
if(idxTracker_[bucket] < (int)bucketRange_) { // if empty rows
|
if(idxTracker_[bucket] < (int)bucketRange_) { // if empty rows
|
||||||
// restriction on fprint value is non-zero
|
// restriction on fprint value is non-zero
|
||||||
T fp = nonZeroSignature(IDs, len, (bucket % MAX_HASH_FUNCS));
|
T fp = nonZeroSignature(IDs, len, (bucket % MAX_HASH_FUNCS));
|
||||||
@ -140,7 +140,7 @@ bool PerfectHash<T>::update(const wordID_t* IDs, const int len,
|
|||||||
}
|
}
|
||||||
// else hash ngram
|
// else hash ngram
|
||||||
//count_t bucket = bucketHash_->hash(IDs, len);
|
//count_t bucket = bucketHash_->hash(IDs, len);
|
||||||
count_t bucket = (bucketHash_->size() > 1 ? bucketHash_->hash(IDs, len, len) : bucketHash_->hash(IDs, len));
|
count_t bucket = (bucketHash_->size() > 1 ? bucketHash_->hash(IDs, len, len) : bucketHash_->hash(IDs, len, 0));
|
||||||
// restriction on fprint value is non-zero
|
// restriction on fprint value is non-zero
|
||||||
T fp = nonZeroSignature(IDs, len, (bucket % MAX_HASH_FUNCS));
|
T fp = nonZeroSignature(IDs, len, (bucket % MAX_HASH_FUNCS));
|
||||||
uint64_t index = bucket * bucketRange_, // starting bucket row
|
uint64_t index = bucket * bucketRange_, // starting bucket row
|
||||||
@ -169,7 +169,7 @@ int PerfectHash<T>::query(const wordID_t* IDs, const int len,
|
|||||||
else { // check if key is in filter
|
else { // check if key is in filter
|
||||||
// get bucket
|
// get bucket
|
||||||
//count_t bucket = bucketHash_->hash(IDs, len);
|
//count_t bucket = bucketHash_->hash(IDs, len);
|
||||||
count_t bucket = (bucketHash_->size() > 1 ? bucketHash_->hash(IDs, len, len) : bucketHash_->hash(IDs, len));
|
count_t bucket = (bucketHash_->size() > 1 ? bucketHash_->hash(IDs, len, len) : bucketHash_->hash(IDs, len, 0));
|
||||||
// restriction on fprint value is non-zero
|
// restriction on fprint value is non-zero
|
||||||
T fp = nonZeroSignature(IDs, len, (bucket % MAX_HASH_FUNCS));
|
T fp = nonZeroSignature(IDs, len, (bucket % MAX_HASH_FUNCS));
|
||||||
// return value if ngram is in filter
|
// return value if ngram is in filter
|
||||||
@ -196,7 +196,7 @@ void PerfectHash<T>::remove(const wordID_t* IDs, const int len) {
|
|||||||
else { // check if key is in filter
|
else { // check if key is in filter
|
||||||
// get small representation for ngrams
|
// get small representation for ngrams
|
||||||
//count_t bucket = bucketHash_->hash(IDs, len);
|
//count_t bucket = bucketHash_->hash(IDs, len);
|
||||||
count_t bucket = (bucketHash_->size() > 1? bucketHash_->hash(IDs, len, len) : bucketHash_->hash(IDs, len));
|
count_t bucket = (bucketHash_->size() > 1? bucketHash_->hash(IDs, len, len) : bucketHash_->hash(IDs, len, 0));
|
||||||
// retrieve non zero fingerprint for ngram
|
// retrieve non zero fingerprint for ngram
|
||||||
T fp = nonZeroSignature(IDs, len, (bucket % MAX_HASH_FUNCS));
|
T fp = nonZeroSignature(IDs, len, (bucket % MAX_HASH_FUNCS));
|
||||||
// return value if ngram is in filter
|
// return value if ngram is in filter
|
||||||
@ -385,7 +385,7 @@ bool PerfectHash<T>::update2(const wordID_t* IDs, const int len,
|
|||||||
}
|
}
|
||||||
// else hash ngram
|
// else hash ngram
|
||||||
//count_t bucket = bucketHash_->hash(IDs, len);
|
//count_t bucket = bucketHash_->hash(IDs, len);
|
||||||
count_t bucket = (bucketHash_->size() > 1 ? bucketHash_->hash(IDs, len, len) : bucketHash_->hash(IDs, len));
|
count_t bucket = (bucketHash_->size() > 1 ? bucketHash_->hash(IDs, len, len) : bucketHash_->hash(IDs, len, 0));
|
||||||
// restriction on fprint value is non-zero
|
// restriction on fprint value is non-zero
|
||||||
T fp = nonZeroSignature(IDs, len, (bucket % MAX_HASH_FUNCS));
|
T fp = nonZeroSignature(IDs, len, (bucket % MAX_HASH_FUNCS));
|
||||||
uint64_t index = bucket * bucketRange_, // starting bucket row
|
uint64_t index = bucket * bucketRange_, // starting bucket row
|
||||||
|
Loading…
Reference in New Issue
Block a user