mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-06-10 16:55:58 +00:00
Fix integer formating
This commit is contained in:
parent
a24aa1c5c6
commit
9e6595b65d
11
src/uart.cpp
11
src/uart.cpp
@ -3,6 +3,7 @@
|
||||
#include <sta/printf.hpp>
|
||||
|
||||
#include <cstring>
|
||||
#include <cinttypes>
|
||||
|
||||
|
||||
|
||||
@ -27,22 +28,22 @@ namespace sta
|
||||
|
||||
void UART::print(uint8_t num, IntegerBase base /* = IntegerBase::DEC */)
|
||||
{
|
||||
printBase(num, base, "%u", sizeof(num));
|
||||
printBase(num, base, "%" PRIu8, sizeof(num));
|
||||
}
|
||||
|
||||
void UART::print(uint16_t num, IntegerBase base /* = IntegerBase::DEC */)
|
||||
{
|
||||
printBase(num, base, "%u", sizeof(num));
|
||||
printBase(num, base, "%" PRIu16, sizeof(num));
|
||||
}
|
||||
|
||||
void UART::print(uint32_t num, IntegerBase base /* = IntegerBase::DEC */)
|
||||
{
|
||||
printBase(num, base, "%lu", sizeof(num));
|
||||
printBase(num, base, "%" PRIu32, sizeof(num));
|
||||
}
|
||||
|
||||
void UART::print(size_t num, IntegerBase base /* = IntegerBase::DEC */)
|
||||
{
|
||||
printBase(num, base, "%u", sizeof(num));
|
||||
printBase(num, base, "%z", sizeof(num));
|
||||
}
|
||||
|
||||
void UART::print(const char * str)
|
||||
@ -142,7 +143,7 @@ namespace sta
|
||||
void UART::printDec(uintmax_t num, const char * fmt)
|
||||
{
|
||||
char buffer[64];
|
||||
snprintf(buffer, sizeof(buffer), fmt, num);
|
||||
snprintf(buffer, sizeof(buffer), fmt, static_cast<uint32_t>(num));
|
||||
print(buffer);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user