]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
types: Define GRUB_CHAR_BIT based on compiler macro instead of using literal
authorGlenn Washburn <development@efficientek.com>
Sat, 7 Nov 2020 04:44:24 +0000 (22:44 -0600)
committerDaniel Kiper <daniel.kiper@oracle.com>
Fri, 20 Nov 2020 14:33:40 +0000 (15:33 +0100)
Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
include/grub/types.h

index 035a4b528fcaae9d71050f71804e83ac644596ff..f22055f98acf07aaecd5231ee5b9d075c3e6bd41 100644 (file)
 # endif
 #endif
 
+#ifndef __CHAR_BIT__
+# error __CHAR_BIT__ is not defined
+#elif __CHAR_BIT__ != 8
+# error __CHAR_BIT__ is not equal 8
+#else
+# define GRUB_CHAR_BIT __CHAR_BIT__
+#endif
+
 /* Define various wide integers.  */
 typedef signed char            grub_int8_t;
 typedef short                  grub_int16_t;
@@ -317,6 +325,4 @@ static inline void grub_set_unaligned64 (void *ptr, grub_uint64_t val)
   dd->d = val;
 }
 
-#define GRUB_CHAR_BIT 8
-
 #endif /* ! GRUB_TYPES_HEADER */