[libc-commits] [libc] [libc] utf8 to 32 CharacterConverter (PR #143973)

Brooks Moses via libc-commits libc-commits at lists.llvm.org
Mon Jun 16 12:53:13 PDT 2025


================
@@ -22,13 +25,65 @@ bool CharacterConverter::isComplete() {
   return state->bytes_processed == state->total_bytes;
 }
 
-int CharacterConverter::push(char8_t utf8_byte) {}
+int CharacterConverter::push(char8_t utf8_byte) {
+  // Checking the first byte if first push
+  if (state->bytes_processed == 0 && state->total_bytes == 0) {
----------------
brooksmoses wrote:

Ah, okay.  My thought is that, if this situation shoudn't happen, why is it useful to check `state->total_bytes == 0` here?  I would just remove that check.  (And then you don't need to reset `state->total_bytes` to zero later.)

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


More information about the libc-commits mailing list