constexpr std::size_t compute_encoded_utf8_size()

in src/libraries/utf/include/m/utf/encode.h [126:141]


        constexpr std::size_t compute_encoded_utf8_size(UtcCharT ch)
        {
            if ((ch >= 0x0011'0000) || ((ch >= 0xdc00) && (ch <= 0xdfff)))
                throw std::runtime_error("invalid character");

            if (ch < 0x0000'0080)
                return 1;

            if (ch < 0x0000'0800)
                return 2;

            if (ch < 0x0001'0000)
                return 3;

            return 4;
        }