MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / fromhex

Function fromhex

tools/cdb2_sqlreplay/cdb2_sqlreplay.cpp:214–224  ·  view source on GitHub ↗

out should be appropriately sized */

Source from the content-addressed store, hash-verified

212
213/* out should be appropriately sized */
214void fromhex(uint8_t *out, const uint8_t *in, size_t len)
215{
216 const uint8_t *end = in + len;
217 while (in != end) {
218 uint8_t i0 = tolower(*(in++));
219 uint8_t i1 = tolower(*(in++));
220 i0 -= isdigit(i0) ? '0' : ('a' - 0xa);
221 i1 -= isdigit(i1) ? '0' : ('a' - 0xa);
222 *(out++) = (i0 << 4) | i1;
223 }
224}
225
226
227/* TODO: add all types supported */

Callers 1

do_bindingsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected