diff options
Diffstat (limited to 'zap/source/any/str/utf8dec.c')
-rw-r--r-- | zap/source/any/str/utf8dec.c | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/zap/source/any/str/utf8dec.c b/zap/source/any/str/utf8dec.c deleted file mode 100644 index add8697..0000000 --- a/zap/source/any/str/utf8dec.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright 2022-2023 Gabriel Jensen. - This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. - If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. -*/ - -#include <zap/str.h> - -void zap_utf8dec(zap_i02 * dest,zap_i8 const * src) { - for (;;++dest) { - zap_i8 const oct = *src; - if (oct == 0x0u) break; - if (oct >= 0xF0u) { /* Four octets. */ - zap_i02 chr = ((zap_i02)oct ^ 0xF0u) << 0x12u; - ++src; - chr += ((zap_i02)*src ^ 0x80u) << 0xCu; - ++src; - chr += ((zap_i02)*src ^ 0x80u) << 0x6u; - ++src; - chr += (zap_i02)*src ^ 0x80u; - ++src; - *dest = chr; - continue; - } - if (oct >= 0xE0u) { /* Three octets. */ - zap_i02 chr = ((zap_i02)oct ^ 0xE0u) << 0xCu; - ++src; - chr += ((zap_i02)*src ^ 0x80u) << 0x6u; - ++src; - chr += (zap_i02)*src ^ 0x80u; - ++src; - *dest = chr; - continue; - } - if (oct >= 0xC0u) { /* Two octets. */ - zap_i02 chr = ((zap_i02)oct ^ 0xC0u) << 0x6u; - ++src; - chr += (zap_i02)*src ^ 0x80u; - ++src; - *dest = chr; - continue; - } - /* One octet. */ - *dest = oct; - ++src; - } -} |