Fix accidental format change

git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@4040 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
heafield 2011-06-27 21:20:42 +00:00
parent 2451371ca2
commit 3616cf09fb
4 changed files with 10 additions and 6 deletions

View File

@ -34,7 +34,7 @@ void MakeBins(float *values, float *values_end, float *centers, uint32_t bins) {
}
}
const char kSeparatelyQuantizeVersion = 1;
const char kSeparatelyQuantizeVersion = 2;
} // namespace

View File

@ -916,14 +916,19 @@ template <class Quant> uint8_t *TrieSearch<Quant>::SetupMemory(uint8_t *start, c
FreeMiddles();
middle_begin_ = static_cast<Middle*>(malloc(sizeof(Middle) * (counts.size() - 2)));
middle_end_ = middle_begin_ + (counts.size() - 2);
uint8_t *middle_starts[counts.size() - 2];
for (unsigned char i = 2; i < counts.size(); ++i) {
middle_starts[i-2] = start;
start += Middle::Size(Quant::MiddleBits(config), counts[i-1], counts[0], counts[i]);
}
// Crazy backwards thing so we initialize in the correct order.
for (unsigned char i = counts.size() - 1; i >= 2; --i) {
new (middle_begin_ + i - 2) Middle(
start,
middle_starts[i-2],
quant_.Mid(i),
counts[0],
counts[i],
(i == counts.size() - 1) ? static_cast<const BitPacked&>(longest) : static_cast<const BitPacked &>(middle_begin_[i-1]));
start += Middle::Size(Quant::MiddleBits(config), counts[i-1], counts[0], counts[i]);
}
longest.Init(start, quant_.Long(counts.size()), counts[0]);
return start + Longest::Size(Quant::LongestBits(config), counts.back(), counts[0]);

View File

@ -31,8 +31,7 @@ class KeyAccessor {
bool FindBitPacked(const void *base, uint64_t key_mask, uint8_t key_bits, uint8_t total_bits, uint64_t begin_index, uint64_t end_index, const uint64_t max_vocab, const uint64_t key, uint64_t &at_index) {
KeyAccessor accessor(base, key_mask, key_bits, total_bits);
if (!util::BoundedSortedUniformFind<uint64_t, KeyAccessor, util::PivotSelect<sizeof(WordIndex)>::T>(accessor, begin_index - 1, (uint64_t)0, end_index, max_vocab, key, at_index)) return false;
return true;
return util::BoundedSortedUniformFind<uint64_t, KeyAccessor, util::PivotSelect<sizeof(WordIndex)>::T>(accessor, begin_index - 1, (uint64_t)0, end_index, max_vocab, key, at_index);
}
} // namespace

View File

@ -67,7 +67,7 @@ template <class Iterator, class Accessor, class Pivot> bool BoundedSortedUniform
Iterator before_it, typename Accessor::Key before_v,
Iterator after_it, typename Accessor::Key after_v,
const typename Accessor::Key key, Iterator &out) {
while (after_it - before_it > 1) {
while (after_it > before_it + 1) {
Iterator pivot(before_it + (1 + Pivot::Calc(key - before_v, after_v - before_v, after_it - before_it - 1)));
typename Accessor::Key mid(accessor(pivot));
if (mid < key) {