diff options
author | bd <bdunahu@operationnull.com> | 2025-04-27 15:20:37 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-04-27 15:20:37 -0400 |
commit | 64efd868deec8921eac16b181f3a2e6d29f90b99 (patch) | |
tree | 096c73c3e74a2afedabd85bd62dbb6720a365ed5 /gui/util.cc | |
parent | 7aaa516c0de444c956dff88342a57e9313a19e34 (diff) | |
parent | 5653b2a033e7a4173d2f178b5ce52384666d3d7b (diff) |
Merge remote-tracking branch 'origin/master' into vector_ext
Diffstat (limited to 'gui/util.cc')
-rw-r--r-- | gui/util.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gui/util.cc b/gui/util.cc new file mode 100644 index 0000000..b62ed81 --- /dev/null +++ b/gui/util.cc @@ -0,0 +1,25 @@ +#include "util.h" +#include "definitions.h" +#include <QString> + +int cache_size_mapper(int total_levels, int level) +{ + const int y_min = 4; + const int y_max = MEM_LINE_SPEC - 4; + double f, r; + + if (total_levels <= 0) + return 7; + + f = level / (double)total_levels; + r = y_min + f * (y_max - y_min); + + return r; +} + +QString format_toggled_value(int value, bool is_hex, bool is_cleared) +{ + if (is_cleared) + return QString(); + return is_hex ? QString::asprintf("%X", value) : QString::number(value); +} |