[riot-notifications] [RIOT-OS/RIOT] sys: add units.h for helper macros (#13530)

benpicco notifications at github.com
Tue May 12 10:53:33 CEST 2020


@benpicco commented on this pull request.



> + * @brief       Unit helper macros
+ *
+ * @author      Benjamin Valentin <benjamin.valentin at ml-pa.com>
+ */
+
+#ifndef UNITS_H
+#define UNITS_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* KiB, MiB, GiB */
+#define KiB(x) ((unsigned long)(x) << 10)
+#define MiB(x) (KiB(x) << 10)
+#define GiB(x) (MiB(x) << 10)

Or just `#define GiB(x) ((unsigned long long)MiB(x) << 10)`?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/13530#discussion_r423571535
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200512/2c159140/attachment.htm>


More information about the notifications mailing list