public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Liming Gao <liming.gao@intel.com>
To: edk2-devel@lists.01.org
Subject: [Patch] BaseTools CommonLib: Fix printf %llx issue on UINT64
Date: Wed,  3 Jan 2018 08:34:28 +0800	[thread overview]
Message-ID: <20180103003428.13040-1-liming.gao@intel.com> (raw)

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



             reply	other threads:[~2018-01-03  0:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-03  0:34 Liming Gao [this message]
2018-01-03  5:05 ` [Patch] BaseTools CommonLib: Fix printf %llx issue on UINT64 Zhu, Yonghong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180103003428.13040-1-liming.gao@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox