[libc-commits] [libc] [libc] Implemented CharacterConverter push/pop for utf32->utf8 conversions (PR #143971)

Uzair Nawaz via libc-commits libc-commits at lists.llvm.org
Thu Jun 12 16:19:04 PDT 2025


================
@@ -22,13 +23,134 @@ bool CharacterConverter::isComplete() {
   return state->bytes_processed == state->total_bytes;
 }
 
-int CharacterConverter::push(char8_t utf8_byte) {}
+int CharacterConverter::push(char32_t utf32) {
+  state->partial = utf32;
+  state->bytes_processed = 0;
----------------
uzairnawaz wrote:

The idea was to increment `bytes_processed` with each call to `pop_utf8`, so that is what I intended it to be.
Ex: 
 push(utf32) // bytes_processed: 0, total_bytes: 4 
 pop_utf8() // bytes_processed: 1, total_bytes: 4
 ... 

https://github.com/llvm/llvm-project/pull/143971


More information about the libc-commits mailing list