grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 04/15] types: Define GRUB_CHAR_BIT based on compiler macro


From: Patrick Steinhardt
Subject: Re: [PATCH v4 04/15] types: Define GRUB_CHAR_BIT based on compiler macro instead of using literal.
Date: Sun, 15 Nov 2020 10:42:39 +0100

On Fri, Nov 06, 2020 at 10:44:24PM -0600, Glenn Washburn wrote:
> Signed-off-by: Glenn Washburn <development@efficientek.com>
> ---
>  include/grub/types.h | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/include/grub/types.h b/include/grub/types.h
> index 035a4b528..495c86bb1 100644
> --- a/include/grub/types.h
> +++ b/include/grub/types.h
> @@ -72,6 +72,14 @@
>  # 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
> +

Nested defines typically use spaces:

#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

Patrick

>  /* 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 */
> -- 
> 2.27.0
> 

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]