MCPcopy Create free account
hub / github.com/FastLED/FastLED / utoa32

Function utoa32

src/fl/stl/charconv.cpp.hpp:138–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136}
137
138int utoa32(u32 value, char *sp, int radix) {
139 char tmp[16]; // be careful with the length of the buffer
140 char *tp = tmp;
141 int i;
142 u32 v = value;
143
144 while (v || tp == tmp) {
145 i = v % radix;
146 v = radix ? v / radix : 0;
147 if (i < 10)
148 *tp++ = i + '0';
149 else
150 *tp++ = i + 'a' - 10;
151 }
152
153 int len = tp - tmp;
154
155 while (tp > tmp)
156 *sp++ = *--tp;
157
158 *sp = '\0'; // Null-terminate the string
159 return len;
160}
161
162int utoa64(u64 value, char *sp, int radix) {
163 char tmp[32]; // larger buffer for 64-bit values

Callers 5

writeMethod · 0.85
writeMethod · 0.85
appendFormattedMethod · 0.85
ostream.cpp.hppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected