mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 22:19:02 +00:00
Logs: compact small hex numbers
This commit is contained in:
parent
81c7920a73
commit
d89f315bd8
2 changed files with 7 additions and 3 deletions
|
|
@ -7,9 +7,14 @@
|
|||
#include <unistd.h>
|
||||
#include <vector>
|
||||
|
||||
static void append_hex(std::string &out, std::uintmax_t value) {
|
||||
static void append_hex(std::string &out, std::unsigned_integral auto value) {
|
||||
std::ostringstream buf;
|
||||
buf << "0x" << std::hex << value;
|
||||
if (value < 10)
|
||||
buf << value;
|
||||
else if (value >= decltype(value)(UINTMAX_MAX) - 1)
|
||||
buf << "-" << -value;
|
||||
else
|
||||
buf << "0x" << std::hex << value;
|
||||
out += buf.str();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue