Browse Source

utils: u32 value prefix should depend on "base" argument (#2005)

master
Max Prokhorov 5 years ago
committed by GitHub
parent
commit
a6c5c7e7c7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      code/espurna/utils.ino

+ 8
- 1
code/espurna/utils.ino View File

@ -713,7 +713,14 @@ uint32_t u32fromString(const String& string) {
String u32toString(uint32_t value, int base) { String u32toString(uint32_t value, int base) {
String result; String result;
result.reserve(32 + 2); result.reserve(32 + 2);
result += "0b";
if (base == 2) {
result += "0b";
} else if (base == 8) {
result += "0o";
} else if (base == 16) {
result += "0x";
}
char buffer[33] = {0}; char buffer[33] = {0};
ultoa(value, buffer, base); ultoa(value, buffer, base);


Loading…
Cancel
Save