File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
include/behaviortree_cpp/utils Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -114,18 +114,23 @@ class SimpleString {
114114 return std::strcmp (data (), other.data ()) > 0 ;
115115 }
116116
117- bool isSOO () const { return !(_storage.soo .capacity_left & IS_LONG_BIT); }
117+ bool isSOO () const {
118+ return !(_storage.soo .capacity_left & IS_LONG_BIT);
119+ }
118120
119121 private:
120- constexpr static std::size_t CAPACITY = sizeof (void *) * 2 - 1 ;
122+
123+ struct String {
124+ char *data;
125+ std::size_t size;
126+ };
127+
128+ constexpr static std::size_t CAPACITY = std::max(size_t (15 ), sizeof (String) - 1 );
121129 constexpr static std::size_t IS_LONG_BIT = 1 << 7 ;
122- constexpr static std::size_t LONG_MASK = ~( uint32_t ( 0 ));
130+ constexpr static std::size_t LONG_MASK = (~std:: size_t ( 0 )) >> 1 ;
123131
124132 union {
125- struct String {
126- char *data;
127- std::size_t size;
128- } str;
133+ String str;
129134
130135 struct SOO {
131136 char data[CAPACITY];
You can’t perform that action at this time.
0 commit comments