File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -288,19 +288,19 @@ class String {
288
288
enum { SSOSIZE = sizeof (struct _ptr ) + 4 - 1 }; // Characters to allocate space for SSO, must be 12 or more
289
289
struct _sso {
290
290
char buff[SSOSIZE];
291
- unsigned char len : 7 ; // Ensure only one byte is allocated by GCC for the bitfields
292
- unsigned char isSSO : 1 ;
291
+ unsigned char len : 7 ; // Ensure only one byte is allocated by GCC for the bitfields
292
+ unsigned char isHeap : 1 ;
293
293
} __attribute__((packed)); // Ensure that GCC doesn't expand the flag byte to a 32-bit word for alignment issues
294
294
enum { CAPACITY_MAX = 65535 }; // If typeof(cap) changed from uint16_t, be sure to update this enum to the max value storable in the type
295
295
union {
296
296
struct _ptr ptr;
297
297
struct _sso sso;
298
298
};
299
299
// Accessor functions
300
- inline bool isSSO () const { return sso.isSSO ; }
300
+ inline bool isSSO () const { return ! sso.isHeap ; }
301
301
inline unsigned int len () const { return isSSO () ? sso.len : ptr.len ; }
302
302
inline unsigned int capacity () const { return isSSO () ? (unsigned int )SSOSIZE - 1 : ptr.cap ; } // Size of max string not including terminal NUL
303
- inline void setSSO (bool set) { sso.isSSO = set; }
303
+ inline void setSSO (bool set) { sso.isHeap = ! set; }
304
304
inline void setLen (int len) { if (isSSO ()) sso.len = len; else ptr.len = len; }
305
305
inline void setCapacity (int cap) { if (!isSSO ()) ptr.cap = cap; }
306
306
inline void setBuffer (char *buff) { if (!isSSO ()) ptr.buff = buff; }
You can’t perform that action at this time.
0 commit comments