BaseTools CommonLib: Fix printf %llx issue on UINT64
authorLiming Gao <liming.gao@intel.com>
Tue, 2 Jan 2018 12:41:43 +0000 (20:41 +0800)
committerLiming Gao <liming.gao@intel.com>
Wed, 3 Jan 2018 06:19:45 +0000 (14:19 +0800)
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>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
BaseTools/Source/C/Common/PcdValueCommon.c

index 6ca0994744bc12dfc629a555149d5bcaec941e8f..42f76ddbbccedfae23c3581cea8f591575f24678 100644 (file)
@@ -266,11 +266,7 @@ Returns:
     sprintf(PcdList[Index].Value, "0x%08x", (UINT32)(Value & 0xffffffff));\r
     break;\r
   case PcdDataTypeUint64:\r
     sprintf(PcdList[Index].Value, "0x%08x", (UINT32)(Value & 0xffffffff));\r
     break;\r
   case PcdDataTypeUint64:\r
-#ifdef __GNUC__\r
-    sprintf(PcdList[Index].Value, "0x%016lx", Value);\r
-#else\r
-    sprintf(PcdList[Index].Value, "0x%016llx", Value);\r
-#endif\r
+    sprintf(PcdList[Index].Value, "0x%016llx", (unsigned long long)Value);\r
     break;\r
   case PcdDataTypePointer:\r
     fprintf (stderr, "PCD %s.%s.%s.%s is structure.  Use PcdSetPtr()\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);\r
     break;\r
   case PcdDataTypePointer:\r
     fprintf (stderr, "PCD %s.%s.%s.%s is structure.  Use PcdSetPtr()\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);\r