Blob Blame History Raw
From fbba8c5118b4ad6595e5d6e4fa85100db66cbe89 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Fri, 8 Jun 2018 16:46:37 -0400
Subject: [PATCH] Work around some intptr_t weirdnesses

Signed-off-by: Peter Jones <pjones@redhat.com>
---
 apps/route80h.c | 2 ++
 inc/efilink.h   | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/apps/route80h.c b/apps/route80h.c
index 5272dd3cd44..462fead906c 100644
--- a/apps/route80h.c
+++ b/apps/route80h.c
@@ -1,6 +1,8 @@
 #include <efi.h>
 #include <efilib.h>
 
+#include <stdint.h>
+
 /* this example program changes the Reserved Page Route (RPR) bit on ICH10's General
  * Control And Status Register (GCS) from LPC to PCI.  In practical terms, it routes
  * outb to port 80h to the PCI bus. */
diff --git a/inc/efilink.h b/inc/efilink.h
index cc5aa2dc57b..40a81581540 100644
--- a/inc/efilink.h
+++ b/inc/efilink.h
@@ -142,7 +142,7 @@ typedef struct _LIST_ENTRY {
 //  EFI_FIELD_OFFSET - returns the byte offset to a field within a structure
 //
 
-#define EFI_FIELD_OFFSET(TYPE,Field) ((UINTN)(intptr_t)(&(((TYPE *) 0)->Field)))
+#define EFI_FIELD_OFFSET(TYPE,Field) __builtin_offsetof(TYPE, Field)
 
 //
 //  CONTAINING_RECORD - returns a pointer to the structure
-- 
2.17.1