MCPcopy Create free account
hub / github.com/bytedance/Fastbot_Android / IntToStringHex

Function IntToStringHex

native/thirdpart/flatbuffers/util.h:201–214  ·  view source on GitHub ↗

Convert an integer value to a hexadecimal string. The returned string length is always xdigits long, prefixed by 0 digits. For example, IntToStringHex(0x23, 8) returns the string "00000023".

Source from the content-addressed store, hash-verified

199// The returned string length is always xdigits long, prefixed by 0 digits.
200// For example, IntToStringHex(0x23, 8) returns the string "00000023".
201inline std::string IntToStringHex(int i, int xdigits) {
202 FLATBUFFERS_ASSERT(i >= 0);
203 // clang-format off
204
205 #ifndef FLATBUFFERS_PREFER_PRINTF
206 std::stringstream ss;
207 ss << std::setw(xdigits) << std::setfill('0') << std::hex << std::uppercase
208 << i;
209 return ss.str();
210 #else // FLATBUFFERS_PREFER_PRINTF
211 return NumToStringImplWrapper(i, "%.*X", xdigits);
212 #endif // FLATBUFFERS_PREFER_PRINTF
213 // clang-format on
214}
215
216// clang-format off
217// Use locale independent functions {strtod_l, strtof_l, strtoll_l, strtoull_l}.

Callers 2

EscapeStringFunction · 0.85
BufferToHexTextFunction · 0.85

Calls 2

NumToStringImplWrapperFunction · 0.85
strMethod · 0.45

Tested by

no test coverage detected