[libcxx-commits] [PATCH] D127566: [libc++] Use unsigned char in basic_string::__short again

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jun 12 12:06:53 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0d108f790858: [libc++] Use unsigned char in basic_string::__short again (authored by philnik).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127566/new/

https://reviews.llvm.org/D127566

Files:
  libcxx/include/string


Index: libcxx/include/string
===================================================================
--- libcxx/include/string
+++ libcxx/include/string
@@ -692,8 +692,8 @@
     {
         value_type __data_[__min_cap];
         unsigned char __padding_[sizeof(value_type) - 1];
-        size_type __size_ : 7;
-        size_type __is_long_ : 1;
+        unsigned char __size_ : 7;
+        unsigned char __is_long_ : 1;
     };
 
 // The __endian_factor is required because the field we use to store the size
@@ -736,14 +736,16 @@
 
     struct __short
     {
-        size_type __is_long_ : 1;
-        size_type __size_ : 7;
+        unsigned char __is_long_ : 1;
+        unsigned char __size_ : 7;
         char __padding_[sizeof(value_type) - 1];
         value_type __data_[__min_cap];
     };
 
 #endif // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
 
+    static_assert(sizeof(__short) == (sizeof(value_type) * (__min_cap + 1)), "__short has an unexpected size.");
+
     union __ulx{__long __lx; __short __lxx;};
 
     enum {__n_words = sizeof(__ulx) / sizeof(size_type)};


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127566.436241.patch
Type: text/x-patch
Size: 1072 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220612/8cfc0e11/attachment.bin>


More information about the libcxx-commits mailing list