aboutsummaryrefslogtreecommitdiff
path: root/include/qemu/units.h
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2018-06-25 09:41:53 -0300
committerPaolo Bonzini <pbonzini@redhat.com>2018-07-02 14:45:23 +0200
commit7ecdc94c40f4958a66893c0eac423c6a80f376d4 (patch)
treee48516071c7fc51dfe07acf0ccc2dea4383b9d3b /include/qemu/units.h
parent5c0ef67ac406b6373b2d32f901752cd0f28e0f61 (diff)
downloadqemu-7ecdc94c40f4958a66893c0eac423c6a80f376d4.zip
qemu-7ecdc94c40f4958a66893c0eac423c6a80f376d4.tar.gz
qemu-7ecdc94c40f4958a66893c0eac423c6a80f376d4.tar.bz2
include: Add IEC binary prefixes in "qemu/units.h"
Loosely based on 076b35b5a56. Suggested-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20180625124238.25339-2-f4bug@amsat.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/qemu/units.h')
-rw-r--r--include/qemu/units.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/qemu/units.h b/include/qemu/units.h
new file mode 100644
index 0000000..692db3f
--- /dev/null
+++ b/include/qemu/units.h
@@ -0,0 +1,20 @@
+/*
+ * IEC binary prefixes definitions
+ *
+ * Copyright (C) 2015 Nikunj A Dadhania, IBM Corporation
+ * Copyright (C) 2018 Philippe Mathieu-Daudé <f4bug@amsat.org>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef QEMU_UNITS_H
+#define QEMU_UNITS_H
+
+#define KiB (INT64_C(1) << 10)
+#define MiB (INT64_C(1) << 20)
+#define GiB (INT64_C(1) << 30)
+#define TiB (INT64_C(1) << 40)
+#define PiB (INT64_C(1) << 50)
+#define EiB (INT64_C(1) << 60)
+
+#endif