diff options
Diffstat (limited to 'zap/source/any/mem/utf8enclen.c')
-rw-r--r-- | zap/source/any/mem/utf8enclen.c | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/zap/source/any/mem/utf8enclen.c b/zap/source/any/mem/utf8enclen.c deleted file mode 100644 index c159653..0000000 --- a/zap/source/any/mem/utf8enclen.c +++ /dev/null @@ -1,32 +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/mem.h> - -zap_sz zap_utf8enclen(zap_i02 const * const _buf) { - zap_sz len = 0x0u; - zap_i02 const * pos; - for (pos = _buf;;++pos) { - zap_i02 const chr = *pos; - if (chr == 0x0u) { - break; - } - if (chr >= 0x10000u) { - len += 0x4u; - continue; - } - if (chr >= 0x800u) { - len += 0x3u; - continue; - } - if (chr >= 0x80u) { - len += 0x2u; - continue; - } - ++len; - } - return len; -} |