MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / GetUTF8Str

Function GetUTF8Str

paddle/phi/kernels/strings/unicode.h:174–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172// Need to guarantee utf8_str has enough memory
173
174HOSTDEVICE inline void GetUTF8Str(const uint32_t* unicode_str,
175 char* utf8_str,
176 size_t unicode_len) {
177 char dst_char[5] = {0};
178 for (size_t i = 0; i < unicode_len; ++i) {
179 uint32_t utf8_uint32 = UnicodeToUTF8(unicode_str[i]);
180 uint32_t utf8_char_count = UnicodeToUTF8Char(utf8_uint32, dst_char);
181 dst_char[utf8_char_count] = '\0';
182 memcpy(utf8_str, dst_char, utf8_char_count);
183 utf8_str += utf8_char_count;
184 }
185 *utf8_str = '\0';
186}
187
188const uint8_t* GetUniFlagMap();
189const uint16_t* GetCharCasesMap();

Callers 2

operator()Method · 0.85

Calls 2

UnicodeToUTF8Function · 0.85
UnicodeToUTF8CharFunction · 0.85

Tested by

no test coverage detected