FastLED 3.9.15
Loading...
Searching...
No Matches

◆ itoa()

static int fl::string_functions::itoa ( int value,
char * sp,
int radix )
static

Definition at line 11 of file str.cpp.

11 {
12 char tmp[16]; // be careful with the length of the buffer
13 char *tp = tmp;
14 int i;
15 unsigned v;
16
17 int sign = (radix == 10 && value < 0);
18 if (sign)
19 v = -value;
20 else
21 v = (unsigned)value;
22
23 while (v || tp == tmp) {
24 i = v % radix;
25 v = radix ? v / radix : 0;
26 if (i < 10)
27 *tp++ = i + '0';
28 else
29 *tp++ = i + 'a' - 10;
30 }
31
32 int len = tp - tmp;
33
34 if (sign) {
35 *sp++ = '-';
36 len++;
37 }
38
39 while (tp > tmp)
40 *sp++ = *--tp;
41
42 return len;
43}

Referenced by fl::StringFormatter::append().

+ Here is the caller graph for this function: