Converts the decimal number specified by Value to a Null-terminated \r
string specified by Buffer containing at most Width characters.\r
If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r
- The total number of characters placed in Buffer is returned.\r
+ The number of characters in Buffer is returned not including the Null-terminator.\r
If the conversion contains more than Width characters, then only the first\r
Width characters are returned, and the total number of characters \r
required to perform the conversion is returned.\r
@param Width The maximum number of characters to place in Buffer.\r
@param Increment Character increment in Buffer.\r
\r
- @return Total number of characters required to perform the conversion.\r
+ @return The number of characters in Buffer not including the Null-terminator.\r
\r
**/\r
UINTN\r
if (Value < 0) {\r
Value = -Value;\r
Buffer = BasePrintLibFillBuffer (Buffer, 1, '-', Increment);\r
+ Width--;\r
}\r
\r
Count = BasePrintLibValueToString (ValueBuffer, Value, 10);\r
Buffer = BasePrintLibFillBuffer (Buffer, Width - Count, '0', Increment);\r
}\r
\r
- Digits = 3 - (Count % 3);\r
+ Digits = Count % 3;\r
+ if (Digits != 0) {\r
+ Digits = 3 - Digits;\r
+ }\r
for (Index = 0; Index < Count; Index++) {\r
Buffer = BasePrintLibFillBuffer (Buffer, 1, ValueBuffer[Count - Index], Increment);\r
if ((Flags & COMMA_TYPE) != 0) {\r
}\r
}\r
\r
- Buffer = BasePrintLibFillBuffer (Buffer, 1, 0, Increment);\r
+ BasePrintLibFillBuffer (Buffer, 1, 0, Increment);\r
\r
return ((Buffer - OriginalBuffer) / Increment);\r
}\r