From 6699cd8b0f0141428def2c334ebc5e60cbe8087d Mon Sep 17 00:00:00 2001 From: royger Date: Thu, 5 Apr 2018 14:31:54 +0000 Subject: [PATCH] introduce GiB and MiB macros This macros convert from GiB or MiB into bytes. Sponsored by: Citrix Systems R&D --- sys/sys/param.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/sys/param.h b/sys/sys/param.h index 7772c17dff3c..63f520e6c2c7 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -362,4 +362,8 @@ __END_DECLS */ #define __PAST_END(array, offset) (((__typeof__(*(array)) *)(array))[offset]) +/* Unit conversion macros. */ +#define GiB(v) (v ## ULL << 30) +#define MiB(v) (v ## ULL << 20) + #endif /* _SYS_PARAM_H_ */