From 6bacbfcbe191ec898e43f4f03e570283b156a8ca Mon Sep 17 00:00:00 2001 From: graehl Date: Fri, 16 Jul 2010 20:08:35 +0000 Subject: vest: oracle_loss argument bugfix git-svn-id: https://ws10smt.googlecode.com/svn/trunk@287 ec762483-ff6d-05da-a07a-a48fb63a330f --- decoder/small_vector.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'decoder') 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 // std::max - where to get this? #include #include +#include #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(capacity_ << 1), min_size); + uint16_t new_cap = std::max(static_cast(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; -- cgit v1.2.3