MCPcopy Create free account
hub / github.com/IoLanguage/io / UArray_asNewHexStringUArray

Function UArray_asNewHexStringUArray

libs/basekit/source/UArray_format.c:86–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86UArray *UArray_asNewHexStringUArray(UArray *self) {
87 size_t i, newSize = self->size * 2;
88 UArray *ba = UArray_new();
89 UArray_setSize_(ba, newSize);
90
91 for (i = 0; i < self->size; i++) {
92 long v = UArray_longAt_(self, i);
93 char *s = (char *)(ba->data + i * 2);
94
95 if (v < 16) {
96 snprintf(s, newSize, "0%x", (int)v);
97 } else {
98 snprintf(s, newSize, "%x", (int)v);
99 }
100 }
101
102 return ba;
103}

Callers

nothing calls this directly

Calls 4

UArray_newFunction · 0.85
UArray_setSize_Function · 0.85
UArray_longAt_Function · 0.85
snprintfFunction · 0.85

Tested by

no test coverage detected