aboutsummaryrefslogtreecommitdiffstats
path: root/src/serd_internal.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-08-29 11:51:37 +0200
committerDavid Robillard <d@drobilla.net>2017-08-29 12:01:09 +0200
commit1423442a9a34c93874ca6896a7b037bf08569aa5 (patch)
treee751956e35471e3bdefdaa6a209f2cbd8c715126 /src/serd_internal.h
parent2976016031592d98a1277a2679d32af9024241dd (diff)
downloadserd-1423442a9a34c93874ca6896a7b037bf08569aa5.tar.gz
serd-1423442a9a34c93874ca6896a7b037bf08569aa5.tar.bz2
serd-1423442a9a34c93874ca6896a7b037bf08569aa5.zip
Fix writing of corrupt UTF-8
Diffstat (limited to 'src/serd_internal.h')
-rw-r--r--src/serd_internal.h8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/serd_internal.h b/src/serd_internal.h
index 267ef6f6..acd66803 100644
--- a/src/serd_internal.h
+++ b/src/serd_internal.h
@@ -340,12 +340,7 @@ utf8_num_bytes(const uint8_t c)
{
if ((c & 0x80) == 0) { // Starts with `0'
return 1;
- }
-
-#ifdef HAVE_BUILTIN_CLZ
- return __builtin_clz(~c << 24);
-#else
- if ((c & 0xE0) == 0xC0) { // Starts with `110'
+ } else if ((c & 0xE0) == 0xC0) { // Starts with `110'
return 2;
} else if ((c & 0xF0) == 0xE0) { // Starts with `1110'
return 3;
@@ -353,7 +348,6 @@ utf8_num_bytes(const uint8_t c)
return 4;
}
return 0;
-#endif
}
/// Return the code point of a UTF-8 character with known length