[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
Sat Jun 11 02:44:10 PDT 2022


philnik created this revision.
philnik added reviewers: ldionne, Mordante, var-const.
Herald added a project: All.
philnik requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

D125496 <https://reviews.llvm.org/D125496> changed the string layout on windows. Change `__is_long_` and `__size_` back to using `unsigned char` to fix the issue.


Repository:
  rG LLVM Github Monorepo

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,8 +736,8 @@
 
     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];
     };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127566.436123.patch
Type: text/x-patch
Size: 795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220611/d9ff26e9/attachment.bin>


More information about the libcxx-commits mailing list