29static void ftoa(
float value,
char *buffer,
int precision = 2) {
33 snprintf(buffer, 64,
"%.*f", precision, value);
44 u32 intPart = (u32)value;
50 intBuf[i++] =
'0' + (intPart % 10);
56 *buffer++ = intBuf[i];
62 float fracPart = value - (u32)value;
63 for (
int j = 0; j < precision; ++j) {
65 int digit = (int)fracPart;
66 *buffer++ =
'0' + digit;
74static int itoa(
int value,
char *sp,
int radix) {
80 int sign = (radix == 10 && value < 0);
86 while (v || tp == tmp) {
88 v = radix ? v / radix : 0;
108static int utoa32(uint32_t value,
char *sp,
int radix) {
114 while (v || tp == tmp) {
116 v = radix ? v / radix : 0;
120 *tp++ = i +
'a' - 10;
131static int utoa64(uint64_t value,
char *sp,
int radix) {
137 while (v || tp == tmp) {
139 v = radix ? v / radix : 0;
143 *tp++ = i +
'a' - 10;
154static float atoff(
const char *str, fl::size len) {
157 float fraction = 0.0f;
158 float divisor = 1.0f;
159 int isFractional = 0;
170 (str[
pos] ==
' ' || str[
pos] ==
'\t' || str[
pos] ==
'\n' ||
171 str[
pos] ==
'\r' || str[
pos] ==
'\f' || str[
pos] ==
'\v')) {
176 if (
pos < len && str[
pos] ==
'-') {
179 }
else if (
pos < len && str[
pos] ==
'+') {
185 if (str[
pos] >=
'0' && str[
pos] <=
'9') {
188 fraction += (str[
pos] -
'0') / divisor;
192 }
else if (str[
pos] ==
'.' && !isFractional) {
213 dst->write(buf, strlen(buf));
219 dst->write(buf, strlen(buf));
225 dst->write(buf, strlen(buf));
229 append(
static_cast<i32
>(val), dst);
233 append(
static_cast<u32
>(val), dst);
275 char *newData = (
char *)realloc(
mData, newLength + 1);
283 char *newData = (
char *)malloc(newLength + 1);
302 return static_cast<int>(f);
314 append(
"\n FFTImpl Bins:\n ");
317 append(
" FFTImpl Bins DB:\n ");
340 append(
"Tile2x2_u8_wrap(");
341 for (
int i = 0; i < 4; i++) {
343 u8 alpha =
data[i].second;
360 if (
this != &other) {
362 char temp[FASTLED_STR_INLINED_SIZE];
363 memcpy(temp,
mInlineData, FASTLED_STR_INLINED_SIZE);
365 memcpy(other.
mInlineData, temp, FASTLED_STR_INLINED_SIZE);
371 static_assert(FASTLED_STR_INLINED_SIZE > 0,
372 "FASTLED_STR_INLINED_SIZE must be greater than 0");
374 "If you want to change the FASTLED_STR_INLINED_SIZE, then it "
375 "must be through a build define and not an include define.");
392 dst->
write(buf, strlen(buf));
398 dst->write(buf, strlen(buf));
fl::string to_string() const
const char * c_str() const
StringHolderPtr mHeapData
fl::size write(const u8 *data, fl::size n)
StringHolder(const char *str)
void grow(fl::size newLength)
fl::pair< vec2< u16 >, u8 > Entry
Result type for promise operations.
string & append(const BitsetFixed< N > &bs)
static void compileTimeAssertions()
static int strcmp(const string &a, const string &b)
static const fl::size npos
const char * data() const
Defines the red, green, and blue (RGB) pixel struct.
FastLED's Elegant JSON Library: fl::Json
Implements the FastLED namespace macros.
static int utoa64(uint64_t value, char *sp, int radix)
static float atoff(const char *str, fl::size len)
static void ftoa(float value, char *buffer, int precision=2)
static int itoa(int value, char *sp, int radix)
static int utoa32(uint32_t value, char *sp, int radix)
void swap(array< T, N > &lhs, array< T, N > &rhs) noexcept(noexcept(lhs.swap(rhs)))
int snprintf(char *buffer, fl::size size, const char *format, const Args &... args)
Snprintf-like formatting function that writes to a buffer.
Representation of an RGB pixel (Red, Green, Blue)
fl::vector< float > bins_raw
fl::vector< float > bins_db