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

Function to_octal

src/fl/stl/stdio.h:201–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199// Convert unsigned integer to octal string
200template<typename T>
201inline fl::string to_octal(T value) FL_NOEXCEPT {
202 if (value == 0) {
203 return "0";
204 }
205
206 char buffer[32]; // Enough for 64-bit octal
207 int pos = 31;
208 buffer[pos] = '\0';
209
210 unsigned long long val = static_cast<unsigned long long>(value);
211 while (val > 0) {
212 buffer[--pos] = '0' + (val & 7);
213 val >>= 3;
214 }
215
216 return fl::string(&buffer[pos]);
217}
218
219// Apply width and padding to a string based on format spec
220inline fl::string apply_width(const fl::string& str, const FormatSpec& spec, bool is_numeric = false) FL_NOEXCEPT {

Callers 1

format_argFunction · 0.85

Calls 1

stringClass · 0.70

Tested by

no test coverage detected