diff mbox

fwts_uefi:uefirtvariable:use sizeof() for defining long integer for fixing build failure on 32 bit systems

Message ID 1356075160-19477-1-git-send-email-ivan.hu@canonical.com
State Accepted
Headers show

Commit Message

Ivan Hu Dec. 21, 2012, 7:32 a.m. UTC
Since the define EFI_NOT_FOUND is move from uefirtvariable.c to fwts_uefi.h
the use sizeof() to find the bit size of the long integer rather than a
fixed value, which avoid build failure should apply on fwts_uefi.h.

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 src/lib/include/fwts_uefi.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Keng-Yu Lin Dec. 21, 2012, 7:42 a.m. UTC | #1
On Fri, Dec 21, 2012 at 3:32 PM, Ivan Hu <ivan.hu@canonical.com> wrote:
> Since the define EFI_NOT_FOUND is move from uefirtvariable.c to fwts_uefi.h
> the use sizeof() to find the bit size of the long integer rather than a
> fixed value, which avoid build failure should apply on fwts_uefi.h.
>
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/lib/include/fwts_uefi.h |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h
> index 72d3c10..2771c55 100644
> --- a/src/lib/include/fwts_uefi.h
> +++ b/src/lib/include/fwts_uefi.h
> @@ -46,7 +46,9 @@ enum {
>         FWTS_UEFI_TIME_IN_DAYLIGHT =            0x02
>  };
>
> -#define HIGH_BIT_SET   (1UL << 63)
> +#define BITS_PER_LONG  (sizeof(long) * 8)
> +
> +#define HIGH_BIT_SET   (1UL << (BITS_PER_LONG-1))
>
>  #define EFI_SUCCESS                    0
>  #define EFI_LOAD_ERROR                 (1 | HIGH_BIT_SET)
> --
> 1.7.10.4
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Alex Hung Dec. 21, 2012, 9:26 a.m. UTC | #2
On 12/21/2012 03:32 PM, Ivan Hu wrote:
> Since the define EFI_NOT_FOUND is move from uefirtvariable.c to fwts_uefi.h
> the use sizeof() to find the bit size of the long integer rather than a
> fixed value, which avoid build failure should apply on fwts_uefi.h.
>
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>   src/lib/include/fwts_uefi.h |    4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h
> index 72d3c10..2771c55 100644
> --- a/src/lib/include/fwts_uefi.h
> +++ b/src/lib/include/fwts_uefi.h
> @@ -46,7 +46,9 @@ enum {
>   	FWTS_UEFI_TIME_IN_DAYLIGHT = 		0x02
>   };
>
> -#define HIGH_BIT_SET	(1UL << 63)
> +#define BITS_PER_LONG	(sizeof(long) * 8)
> +
> +#define HIGH_BIT_SET	(1UL << (BITS_PER_LONG-1))
>
>   #define EFI_SUCCESS			0
>   #define EFI_LOAD_ERROR			(1 | HIGH_BIT_SET)
>
Acked-by: Alex Hung <alex.hung@canonical.com>
Colin Ian King Dec. 21, 2012, 12:15 p.m. UTC | #3
On 21/12/12 07:32, Ivan Hu wrote:
> Since the define EFI_NOT_FOUND is move from uefirtvariable.c to fwts_uefi.h
> the use sizeof() to find the bit size of the long integer rather than a
> fixed value, which avoid build failure should apply on fwts_uefi.h.
>
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>   src/lib/include/fwts_uefi.h |    4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h
> index 72d3c10..2771c55 100644
> --- a/src/lib/include/fwts_uefi.h
> +++ b/src/lib/include/fwts_uefi.h
> @@ -46,7 +46,9 @@ enum {
>   	FWTS_UEFI_TIME_IN_DAYLIGHT = 		0x02
>   };
>
> -#define HIGH_BIT_SET	(1UL << 63)
> +#define BITS_PER_LONG	(sizeof(long) * 8)
> +
> +#define HIGH_BIT_SET	(1UL << (BITS_PER_LONG-1))
>
>   #define EFI_SUCCESS			0
>   #define EFI_LOAD_ERROR			(1 | HIGH_BIT_SET)
>
diff mbox

Patch

diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h
index 72d3c10..2771c55 100644
--- a/src/lib/include/fwts_uefi.h
+++ b/src/lib/include/fwts_uefi.h
@@ -46,7 +46,9 @@  enum {
 	FWTS_UEFI_TIME_IN_DAYLIGHT = 		0x02
 };
 
-#define HIGH_BIT_SET	(1UL << 63)
+#define BITS_PER_LONG	(sizeof(long) * 8)
+
+#define HIGH_BIT_SET	(1UL << (BITS_PER_LONG-1))
 
 #define EFI_SUCCESS			0
 #define EFI_LOAD_ERROR			(1 | HIGH_BIT_SET)