[libc-commits] [libc] f94950d - [libc] Changed mbstate struct (#143942)

via libc-commits libc-commits at lists.llvm.org
Thu Jun 12 11:04:29 PDT 2025


Author: sribee8
Date: 2025-06-12T18:04:26Z
New Revision: f94950db89a905309ec9ea2245889df88ffd0690

URL: https://github.com/llvm/llvm-project/commit/f94950db89a905309ec9ea2245889df88ffd0690
DIFF: https://github.com/llvm/llvm-project/commit/f94950db89a905309ec9ea2245889df88ffd0690.diff

LOG: [libc] Changed mbstate struct (#143942)

Changed the mbstate variable from bits processed to bytes processed and
implemented isComplete().

Co-authored-by: Sriya Pratipati <sriyap at google.com>

Added: 
    

Modified: 
    libc/src/__support/wchar/character_converter.cpp
    libc/src/__support/wchar/mbstate.h

Removed: 
    


################################################################################
diff  --git a/libc/src/__support/wchar/character_converter.cpp b/libc/src/__support/wchar/character_converter.cpp
index 3cdb8ca83b7f0..f09c7815a6cc4 100644
--- a/libc/src/__support/wchar/character_converter.cpp
+++ b/libc/src/__support/wchar/character_converter.cpp
@@ -18,7 +18,9 @@ namespace internal {
 
 CharacterConverter::CharacterConverter(mbstate *mbstate) { state = mbstate; }
 
-bool CharacterConverter::isComplete() {}
+bool CharacterConverter::isComplete() {
+  return state->bytes_processed == state->total_bytes;
+}
 
 int CharacterConverter::push(char8_t utf8_byte) {}
 

diff  --git a/libc/src/__support/wchar/mbstate.h b/libc/src/__support/wchar/mbstate.h
index cb8950374de41..d33ee354a5443 100644
--- a/libc/src/__support/wchar/mbstate.h
+++ b/libc/src/__support/wchar/mbstate.h
@@ -18,7 +18,7 @@ namespace internal {
 
 struct mbstate {
   char32_t partial;
-  uint8_t bits_processed;
+  uint8_t bytes_processed;
   uint8_t total_bytes;
 };
 


        


More information about the libc-commits mailing list