| 199 | // Convert unsigned integer to octal string |
| 200 | template<typename T> |
| 201 | inline 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 |
| 220 | inline fl::string apply_width(const fl::string& str, const FormatSpec& spec, bool is_numeric = false) FL_NOEXCEPT { |