Mike,
Thanks for the clarification. This means Print() cannot print a 64-bit unsigned
value in a decimal formatted output, but can handle it in a hex formatted
output. I think this is fine. Updating the library comments is sufficient.
Thanks,
--Samer
From: Kinney, Michael D [mailto:michael.d.kin...@intel.com]
Sent: Wednesday, July 24, 2013 5:54 PM
To: El-Haj-Mahmoud, Samer; edk2-devel@lists.sourceforge.net; Kinney, Michael D
Subject: RE: Print(L"%d") issue with 64-bit values
Samer,
I think we may need some clarifications in the PrintLib.h. The data type in
the format string descriptions are there to make sure the size of each variable
argument is defined so the variable argument list is parsed correctly.
%x, %lx, %X, and %lX are consistent printed as unsigned values.
%d and %ld are consistently printed as signed values.
Maybe change descriptions from:
- L, l
- The number being printed is a UINT64. Only valid for types X, x, and d.
If this flag is not specified, then the number being printed is a int.
- x
- The argument is a hexadecimal number. The characters used are 0..9 and
A..F. If the flag 'L' is not specified, then the argument is assumed
to be an int. This does not follow ANSI C.
- X
- The argument is a hexadecimal number and the number is padded with
zeros. This is equivalent to a format string of "0x". If the flag
'L' is not specified, then the argument is assumed to be an int.
This does not follow ANSI C.
- d
- The argument is a decimal number. If the flag 'L' is not specified,
then the argument is assumed to be an int.
- p
- The argument is a pointer that is a (VOID *), and it is printed as a
hexadecimal number The characters used are 0..9 and A..F.
To:
- L, l
- The number being printed is size UINT64. Only valid for types X, x,
and d.
If this flag is not specified, then the number being printed is size
int.
- x
- The argument is an unsigned hexadecimal number. The characters used
are 0..9 and
A..F. If the flag 'L' is not specified, then the argument is assumed
to be size int. This does not follow ANSI C.
- X
- The argument is an unsigned hexadecimal number and the number is padded
with
zeros. This is equivalent to a format string of "0x". If the flag
'L' is not specified, then the argument is assumed to be size int.
This does not follow ANSI C.
- d
- The argument is a signed decimal number. If the flag 'L' is not
specified,
then the argument is assumed to be size int.
- p
- The argument is a pointer that is a (VOID *), and it is printed as an
unsigned hexadecimal number The characters used are 0..9 and A..F.
Mike
From: El-Haj-Mahmoud, Samer
[mailto:samer.el-haj-mahm...@hp.com]<mailto:[mailto:samer.el-haj-mahm...@hp.com]>
Sent: Wednesday, July 24, 2013 2:56 PM
To: edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
Subject: [edk2] Print(L"%d") issue with 64-bit values
Here is an observation with PrintLib :
UINT16 myuint16 = 0xFFFF;
Print(L"%d", myuint16) --> displays 65535.
So far, so good.
UINT32 myuint32 = 0xFFFFFFFF;
Print(L"%d", myuint32) --> displays -1
Print(L"%ld", myuint32) --> displays 4294967295.
That is good. %ld handles a 32bit value where all bits are 1.
But the same does not work for a 64bit value:
UINT64 myuint64 = 0xFFFFFFFFFFFFFFFF;
Print(L"%ld", myuint64) --> displays -1
According to the library header file at MdePkg\Include\Library\PrintLib.h,
using "%Ld" should indicate UINT64. However, the code seems to use INT64.
Thanks,
--Samer
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel