MCPcopy Create free account
hub / github.com/baidu/tera / UIntToHexBufferInternal

Function UIntToHexBufferInternal

src/common/base/string_number.cc:175–183  ·  view source on GitHub ↗

--------------------------------------------------------- unsigned int to hex buffer or string. ---------------------------------------------------------

Source from the content-addressed store, hash-verified

173// unsigned int to hex buffer or string.
174// ---------------------------------------------------------
175static char* UIntToHexBufferInternal(uint64_t value, char* buffer, int num_byte) {
176 static const char hexdigits[] = "0123456789abcdef";
177 int digit_byte = 2 * num_byte;
178 for (int i = digit_byte - 1; i >= 0; i--) {
179 buffer[i] = hexdigits[uint32_t(value) & 0xf];
180 value >>= 4;
181 }
182 return buffer + digit_byte;
183}
184
185char* WriteHexUInt16ToBuffer(uint16_t value, char* buffer) {
186 return UIntToHexBufferInternal(value, buffer, sizeof(value));

Callers 3

WriteHexUInt16ToBufferFunction · 0.85
WriteHexUInt32ToBufferFunction · 0.85
WriteHexUInt64ToBufferFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected