MCPcopy Create free account
hub / github.com/boostorg/parser / read_into_buf

Function read_into_buf

include/boost/parser/detail/text/transcode_iterator.hpp:45–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43
44 template<typename OutIter>
45 inline constexpr OutIter read_into_buf(char32_t cp, OutIter buf)
46 {
47 if (cp < 0x80) {
48 *buf = static_cast<char>(cp);
49 ++buf;
50 } else if (cp < 0x800) {
51 *buf = static_cast<char>(0xC0 + (cp >> 6));
52 ++buf;
53 *buf = static_cast<char>(0x80 + (cp & 0x3f));
54 ++buf;
55 } else if (cp < 0x10000) {
56 *buf = static_cast<char>(0xe0 + (cp >> 12));
57 ++buf;
58 *buf = static_cast<char>(0x80 + ((cp >> 6) & 0x3f));
59 ++buf;
60 *buf = static_cast<char>(0x80 + (cp & 0x3f));
61 ++buf;
62 } else {
63 *buf = static_cast<char>(0xf0 + (cp >> 18));
64 ++buf;
65 *buf = static_cast<char>(0x80 + ((cp >> 12) & 0x3f));
66 ++buf;
67 *buf = static_cast<char>(0x80 + ((cp >> 6) & 0x3f));
68 ++buf;
69 *buf = static_cast<char>(0x80 + (cp & 0x3f));
70 ++buf;
71 }
72 return buf;
73 }
74
75 template<typename OutIter>
76 constexpr OutIter write_cp_utf8(char32_t cp, OutIter out)

Callers 1

write_cp_utf8Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected