MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / hex

Function hex

libraries/printHelpers/printHelpers.cpp:343–356  ·  view source on GitHub ↗

/////////////////////////////////////////////////////// HEX always leading zero's - no prefix - no separator

Source from the content-addressed store, hash-verified

341//
342// always leading zero's - no prefix - no separator
343char * hex(uint64_t value, uint8_t digits)
344{
345 uint64_t val = value;
346 char * buffer = __printbuffer;
347 buffer[digits] = '\0';
348 while (digits > 0)
349 {
350 uint8_t v = val & 0x0F;
351 val >>= 4;
352 digits--;
353 buffer[digits] = (v < 10) ? '0' + v : ('A' - 10) + v;
354 }
355 return buffer;
356}
357
358// faster than 64 bit.
359char * hex(uint32_t value, uint8_t digits)

Callers 1

unittestFunction · 0.50

Calls

no outgoing calls

Tested by 1

unittestFunction · 0.40