From 3421b0397360876854fb7cc1b7c428166aa2c790 Mon Sep 17 00:00:00 2001 From: Drath Date: Thu, 3 Jul 2025 01:04:37 +0200 Subject: [PATCH] oops this needs to be first --- main.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/main.cpp b/main.cpp index 0ba0554..cd75a75 100644 --- a/main.cpp +++ b/main.cpp @@ -31,6 +31,14 @@ struct mem_usage_t { bool daemon_mode = false; /* DISPLAY FUNCS */ +// converts number to string with given decimal places +std::string pNum(auto num, uint8_t decs = 0) { + std::stringstream ret; + ret << std::fixed << std::setprecision(decs) << num; + return ret.str(); +} + + // converts large number in (k)bytes to human readable numer with suffix and sane decimal std::string pBytes(double bytes, bool isKbytes = false) { std::array suffix_list = {'K', 'M', 'G', 'T', 'P', 'E', 'Z'}; @@ -47,13 +55,6 @@ std::string pBytes(double bytes, bool isKbytes = false) { return "++++"; } -// converts number to string with given decimal places -std::string pNum(auto num, uint8_t decs = 0) { - std::stringstream ret; - ret << std::fixed << std::setprecision(decs) << num; - return ret.str(); -} - // pads given string to length std::string pad(std::string s, uint8_t len, bool ljust = false) { if (len > s.size())