public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] BaseTools CommonLib: Fix printf %llx issue on UINT64
@ 2018-01-03  0:34 Liming Gao
  2018-01-03  5:05 ` Zhu, Yonghong
  0 siblings, 1 reply; 2+ messages in thread
From: Liming Gao @ 2018-01-03  0:34 UTC (permalink / raw)
  To: edk2-devel

UINT64 is defined as the different type for the different ARCHs. To
let it work for all archs and compilers, add (unsigned long long) for
the input value together with %llx.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
 BaseTools/Source/C/Common/PcdValueCommon.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/BaseTools/Source/C/Common/PcdValueCommon.c b/BaseTools/Source/C/Common/PcdValueCommon.c
index 6ca0994744..42f76ddbbc 100644
--- a/BaseTools/Source/C/Common/PcdValueCommon.c
+++ b/BaseTools/Source/C/Common/PcdValueCommon.c
@@ -266,11 +266,7 @@ Returns:
     sprintf(PcdList[Index].Value, "0x%08x", (UINT32)(Value & 0xffffffff));
     break;
   case PcdDataTypeUint64:
-#ifdef __GNUC__
-    sprintf(PcdList[Index].Value, "0x%016lx", Value);
-#else
-    sprintf(PcdList[Index].Value, "0x%016llx", Value);
-#endif
+    sprintf(PcdList[Index].Value, "0x%016llx", (unsigned long long)Value);
     break;
   case PcdDataTypePointer:
     fprintf (stderr, "PCD %s.%s.%s.%s is structure.  Use PcdSetPtr()\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
-- 
2.11.0.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch] BaseTools CommonLib: Fix printf %llx issue on UINT64
  2018-01-03  0:34 [Patch] BaseTools CommonLib: Fix printf %llx issue on UINT64 Liming Gao
@ 2018-01-03  5:05 ` Zhu, Yonghong
  0 siblings, 0 replies; 2+ messages in thread
From: Zhu, Yonghong @ 2018-01-03  5:05 UTC (permalink / raw)
  To: Gao, Liming, edk2-devel@lists.01.org

Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> 

Best Regards,
Zhu Yonghong

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Liming Gao
Sent: Wednesday, January 3, 2018 8:34 AM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch] BaseTools CommonLib: Fix printf %llx issue on UINT64

UINT64 is defined as the different type for the different ARCHs. To let it work for all archs and compilers, add (unsigned long long) for the input value together with %llx.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
 BaseTools/Source/C/Common/PcdValueCommon.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/BaseTools/Source/C/Common/PcdValueCommon.c b/BaseTools/Source/C/Common/PcdValueCommon.c
index 6ca0994744..42f76ddbbc 100644
--- a/BaseTools/Source/C/Common/PcdValueCommon.c
+++ b/BaseTools/Source/C/Common/PcdValueCommon.c
@@ -266,11 +266,7 @@ Returns:
     sprintf(PcdList[Index].Value, "0x%08x", (UINT32)(Value & 0xffffffff));
     break;
   case PcdDataTypeUint64:
-#ifdef __GNUC__
-    sprintf(PcdList[Index].Value, "0x%016lx", Value);
-#else
-    sprintf(PcdList[Index].Value, "0x%016llx", Value);
-#endif
+    sprintf(PcdList[Index].Value, "0x%016llx", (unsigned long 
+ long)Value);
     break;
   case PcdDataTypePointer:
     fprintf (stderr, "PCD %s.%s.%s.%s is structure.  Use PcdSetPtr()\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
--
2.11.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-03  5:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-03  0:34 [Patch] BaseTools CommonLib: Fix printf %llx issue on UINT64 Liming Gao
2018-01-03  5:05 ` Zhu, Yonghong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox