summaryrefslogtreecommitdiff
path: root/decoder
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-16 20:08:35 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-16 20:08:35 +0000
commit7748591e24ec1be037db14f36e758fac8ded65d8 (patch)
treeb0d0401d88214daf5dfd4d4b1b363c5b9f77dd8f /decoder
parentfe67163cec1cc80e55c490e80070047239c1120d (diff)
vest: oracle_loss argument bugfix
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@287 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder')
-rw-r--r--decoder/small_vector.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/decoder/small_vector.h b/decoder/small_vector.h
index 800c1df1..86d3b0b3 100644
--- a/decoder/small_vector.h
+++ b/decoder/small_vector.h
@@ -3,6 +3,7 @@
#include <streambuf> // std::max - where to get this?
#include <cstring>
#include <cassert>
+#include <limits.h>
#define __SV_MAX_STATIC 2
@@ -77,10 +78,10 @@ class SmallVector {
bool empty() const { return size_ == 0; }
size_t size() const { return size_; }
- inline void ensure_capacity(unsigned char min_size) {
+ inline void ensure_capacity(uint16_t min_size) {
assert(min_size > __SV_MAX_STATIC);
if (min_size < capacity_) return;
- unsigned char new_cap = std::max(static_cast<unsigned char>(capacity_ << 1), min_size);
+ uint16_t new_cap = std::max(static_cast<uint16_t>(capacity_ << 1), min_size);
int* tmp = new int[new_cap];
std::memcpy(tmp, data_.ptr, capacity_ * sizeof(int));
delete[] data_.ptr;
@@ -170,8 +171,8 @@ class SmallVector {
}
private:
- unsigned char capacity_; // only defined when size_ >= __SV_MAX_STATIC
- unsigned char size_;
+ uint16_t capacity_; // only defined when size_ >= __SV_MAX_STATIC
+ uint16_t size_;
union StorageType {
int vals[__SV_MAX_STATIC];
int* ptr;