MCPcopy Create free account
hub / github.com/comaps/comaps / NumToHex

Function NumToHex

libs/coding/hex.hpp:42–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40/// @{
41template <typename IntT>
42inline std::string NumToHex(IntT n)
43{
44 static_assert(std::is_integral<IntT>::value, "");
45
46 uint8_t buf[sizeof(n)];
47
48 for (size_t i = 0; i < sizeof(n); ++i)
49 {
50 buf[i] = (n >> ((sizeof(n) - 1) * 8));
51 n <<= 8;
52 }
53
54 return ToHex(buf, sizeof(buf));
55}
56
57template <>
58inline std::string NumToHex<int8_t>(int8_t c)

Callers 7

UrlEncodeFunction · 0.85
UNIT_TESTFunction · 0.85
SaveColorToABGRFunction · 0.85
SaveColorToRGBFunction · 0.85
SaveColorToARGBFunction · 0.85
FormatBytesFromBufferFunction · 0.85
ShapeTextMethod · 0.85

Calls 1

ToHexFunction · 0.85

Tested by 2

UNIT_TESTFunction · 0.68
FormatBytesFromBufferFunction · 0.68