summaryrefslogtreecommitdiff
path: root/src/utils/size_info.h
diff options
context:
space:
mode:
authorMole Shang <[email protected]>2023-08-08 12:16:59 +0800
committerMole Shang <[email protected]>2023-08-08 12:22:00 +0800
commitbbf7aed9ac484d7955b4d1888c9b2f93ffd44ba3 (patch)
tree944b132b070eaca3c5ef3a664d61b70d931a4271 /src/utils/size_info.h
parentf0121e1596dc5490b58b6dad1bfb8f3b83d19b94 (diff)
downloadhinata-bbf7aed9ac484d7955b4d1888c9b2f93ffd44ba3.tar.gz
hinata-bbf7aed9ac484d7955b4d1888c9b2f93ffd44ba3.tar.bz2
hinata-bbf7aed9ac484d7955b4d1888c9b2f93ffd44ba3.zip
ui: match size measures with corresponding units
Calculate the size in UI to align with suitable units.
Diffstat (limited to 'src/utils/size_info.h')
-rw-r--r--src/utils/size_info.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/utils/size_info.h b/src/utils/size_info.h
new file mode 100644
index 0000000..e0994c1
--- /dev/null
+++ b/src/utils/size_info.h
@@ -0,0 +1,14 @@
+#ifndef SIZE_INFO_H_
+#define SIZE_INFO_H_
+
+typedef enum size_unit { SIZE_B, SIZE_KB, SIZE_MB, SIZE_GB } size_unit_t;
+
+typedef struct size_info {
+ long double n;
+ size_unit_t unit;
+ const char *unit_str;
+} size_info_t;
+
+size_info_t num2sizeinfo(const unsigned long n);
+
+#endif