aboutsummaryrefslogtreecommitdiffstats
path: root/src/string_utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/string_utils.h')
-rw-r--r--src/string_utils.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/string_utils.h b/src/string_utils.h
index 744ba4ca..a80c3a27 100644
--- a/src/string_utils.h
+++ b/src/string_utils.h
@@ -119,13 +119,20 @@ utf8_num_bytes(const uint8_t c)
{
if ((c & 0x80) == 0) { // Starts with `0'
return 1;
- } else if ((c & 0xE0) == 0xC0) { // Starts with `110'
+ }
+
+ if ((c & 0xE0) == 0xC0) { // Starts with `110'
return 2;
- } else if ((c & 0xF0) == 0xE0) { // Starts with `1110'
+ }
+
+ if ((c & 0xF0) == 0xE0) { // Starts with `1110'
return 3;
- } else if ((c & 0xF8) == 0xF0) { // Starts with `11110'
+ }
+
+ if ((c & 0xF8) == 0xF0) { // Starts with `11110'
return 4;
}
+
return 0;
}