From 237aedc590b58c0e69d7dfcac92b5f767b7c004a Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:17:51 +0200 Subject: 4.6 --- zen/string_base.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'zen/string_base.h') diff --git a/zen/string_base.h b/zen/string_base.h index ffc2f839..88da13bf 100644 --- a/zen/string_base.h +++ b/zen/string_base.h @@ -9,6 +9,7 @@ #include #include +#include #include "string_tools.h" #include @@ -76,7 +77,7 @@ protected: newDescr->length = size; newDescr->capacity = newCapacity; - return reinterpret_cast(newDescr + 1); + return reinterpret_cast(newDescr + 1); //alignment note: "newDescr + 1" is Descriptor-aligned, which is larger than alignment for Char-array! => no problem! } static Char* clone(Char* ptr) @@ -101,8 +102,8 @@ protected: private: struct Descriptor { - size_t length; - size_t capacity; //allocated size without null-termination + std::uint32_t length; + std::uint32_t capacity; //allocated size without null-termination }; static Descriptor* descr( Char* ptr) { return reinterpret_cast< Descriptor*>(ptr) - 1; } @@ -173,8 +174,8 @@ private: Descriptor(long rc, size_t len, size_t cap) : refCount(rc), length(len), capacity(cap) {} boost::detail::atomic_count refCount; //practically no perf loss: ~0.2%! (FFS comparison) - size_t length; - size_t capacity; //allocated size without null-termination + std::uint32_t length; + std::uint32_t capacity; //allocated size without null-termination }; static Descriptor* descr( Char* ptr) { return reinterpret_cast< Descriptor*>(ptr) - 1; } -- cgit