diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2025-05-22 12:10:50 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2025-05-22 12:10:50 -0700 |
commit | b4d5f05822b3e45442a027121fe5bf66c64c432b (patch) | |
tree | 1ecc5321e1290618704fe261a5974b891680ad46 | |
parent | 68e0bbfcfce586f692b0c4671c31119152c68996 (diff) | |
download | txr-b4d5f05822b3e45442a027121fe5bf66c64c432b.tar.gz txr-b4d5f05822b3e45442a027121fe5bf66c64c432b.tar.bz2 txr-b4d5f05822b3e45442a027121fe5bf66c64c432b.zip |
utf8: use unsigned int in decoder.
* utf8.h (utf8_decoder_t): Declare the flags member as well
as the buffer indices head, tail and back as unsigned.
Bitmask fields holding flags should be unsigned.
Regarding the indices, we perform % 8 reductions on them in
the decoder, which optimizes much better for unsigned types.
-rw-r--r-- | utf8.h | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -41,9 +41,9 @@ enum utf8_state { utf8_init, utf8_more1, utf8_more2, utf8_more3 }; typedef struct utf8_decoder { enum utf8_state state; - int flags; + unsigned flags; wchar_t wch, wch_min; - int head, tail, back; + unsigned head, tail, back; int buf[8]; } utf8_decoder_t; |