diff --git a/src/memory.h b/src/memory.h index 6a8f2a63..9f71d78f 100644 --- a/src/memory.h +++ b/src/memory.h @@ -117,7 +117,7 @@ static_assert(std::numeric_limits::is_iec559); template struct SmallArrayPool { - std::deque buckets[__Bucket+1]; + std::vector buckets[__Bucket+1]; T* alloc(int n){ if(n == 0) return nullptr; diff --git a/src/str.h b/src/str.h index 6ff29794..f1751d64 100644 --- a/src/str.h +++ b/src/str.h @@ -133,9 +133,9 @@ bool is_unicode_Lo_char(uint32_t c) { struct StrName { - uint32_t index; + uint16_t index; StrName(): index(0) {} - StrName(int index): index(index) {} + StrName(uint16_t index): index(index) {} StrName(const char* s): index(get(s).index) {} StrName(const Str& s): index(get(s).index) {} inline const Str& str() const { return _r_interned[index-1]; } @@ -157,7 +157,7 @@ struct StrName { return this->index > other.index; } - static std::map> _interned; + static std::map> _interned; static std::vector _r_interned; inline static StrName get(const Str& s){ @@ -167,14 +167,14 @@ struct StrName { static StrName get(const char* s){ auto it = _interned.find(s); if(it != _interned.end()) return StrName(it->second); - uint32_t index = _r_interned.size() + 1; + uint16_t index = (uint16_t)(_r_interned.size() + 1); _interned[s] = index; _r_interned.push_back(s); return StrName(index); } }; -std::map> StrName::_interned; +std::map> StrName::_interned; std::vector StrName::_r_interned; const StrName __class__ = StrName::get("__class__");