mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-06-29 09:07:17 -04:00
Faster app_settings save (#1145)
* No-allocation settings save * remove fixed TODO --------- Co-authored-by: kallanreed <kallanreed@outlook.com>
This commit is contained in:
parent
8bd3d6249d
commit
fff78ce00f
3 changed files with 30 additions and 2 deletions
|
@ -23,6 +23,7 @@
|
|||
#define __STRING_FORMAT_H__
|
||||
|
||||
#include <cstdint>
|
||||
#include <array>
|
||||
#include <string>
|
||||
|
||||
#include "file.hpp"
|
||||
|
@ -39,6 +40,11 @@ enum TimeFormat {
|
|||
|
||||
const char unit_prefix[7]{'n', 'u', 'm', 0, 'k', 'M', 'G'};
|
||||
|
||||
using StringFormatBuffer = std::array<char, 16>;
|
||||
|
||||
/* uint32_t conversion without memory allocations. */
|
||||
char* to_string_dec_uint(const uint32_t n, StringFormatBuffer& buffer, size_t& length);
|
||||
|
||||
// TODO: Allow l=0 to not fill/justify? Already using this way in ui_spectrum.hpp...
|
||||
std::string to_string_bin(const uint32_t n, const uint8_t l = 0);
|
||||
std::string to_string_dec_uint(const uint32_t n, const int32_t l = 0, const char fill = ' ');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue