summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2025-05-22 12:10:50 -0700
committerKaz Kylheku <kaz@kylheku.com>2025-05-22 12:10:50 -0700
commitb4d5f05822b3e45442a027121fe5bf66c64c432b (patch)
tree1ecc5321e1290618704fe261a5974b891680ad46
parent68e0bbfcfce586f692b0c4671c31119152c68996 (diff)
downloadtxr-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.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/utf8.h b/utf8.h
index d0182e97..3300cfbd 100644
--- a/utf8.h
+++ b/utf8.h
@@ -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;