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 66 of file str.cpp.

66 {
67 char tmp[16]; // be careful with the length of the buffer
68 char *tp = tmp;
69 int i;
70 unsigned v;
71
72 int sign = (radix == 10 && value < 0);
73 if (sign)
74 v = -value;
75 else
76 v = (unsigned)value;
77
78 while (v || tp == tmp) {
79 i = v % radix;
80 v = radix ? v / radix : 0;
81 if (i < 10)
82 *tp++ = i + '0';
83 else
84 *tp++ = i + 'a' - 10;
85 }
86
87 int len = tp - tmp;
88
89 if (sign) {
90 *sp++ = '-';
91 len++;
92 }
93
94 while (tp > tmp)
95 *sp++ = *--tp;
96
97 return len;
98}

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

+ Here is the caller graph for this function: