MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / jl_encode_utf8

Function jl_encode_utf8

src/cli/config_json_like.c:659–680  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

657}
658
659static size_t jl_encode_utf8(uint32_t codepoint, unsigned char output[4]) {
660 if (codepoint <= 0x7FU) {
661 output[0] = (unsigned char)codepoint;
662 return 1U;
663 }
664 if (codepoint <= 0x7FFU) {
665 output[0] = (unsigned char)(0xC0U | (codepoint >> 6U));
666 output[1] = (unsigned char)(0x80U | (codepoint & 0x3FU));
667 return 2U;
668 }
669 if (codepoint <= 0xFFFFU) {
670 output[0] = (unsigned char)(0xE0U | (codepoint >> 12U));
671 output[1] = (unsigned char)(0x80U | ((codepoint >> 6U) & 0x3FU));
672 output[2] = (unsigned char)(0x80U | (codepoint & 0x3FU));
673 return 3U;
674 }
675 output[0] = (unsigned char)(0xF0U | (codepoint >> 18U));
676 output[1] = (unsigned char)(0x80U | ((codepoint >> 12U) & 0x3FU));
677 output[2] = (unsigned char)(0x80U | ((codepoint >> 6U) & 0x3FU));
678 output[3] = (unsigned char)(0x80U | (codepoint & 0x3FU));
679 return 4U;
680}
681
682static uint32_t jl_decode_hex4(const char *text) {
683 uint32_t value = 0;

Callers 2

jl_key_equalsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected