}\r
case 'X':\r
case 'x':\r
+ case 'u':\r
case 'd':\r
if (Long) {\r
BASE_ARG (BaseListMarker, INT64) = VA_ARG (VaListMarker, INT64);\r
#define PRECISION BIT11\r
#define ARGUMENT_REVERSED BIT12\r
#define COUNT_ONLY_NO_PRINT BIT13\r
+#define UNSIGNED_TYPE BIT14\r
\r
//\r
// Record date and time information\r
//\r
// break skipped on purpose\r
//\r
+ case 'u':\r
+ if ((Flags & RADIX_HEX) == 0) {\r
+ Flags &= ~((UINTN) (PREFIX_SIGN));\r
+ Flags |= UNSIGNED_TYPE;\r
+ }\r
+ //\r
+ // break skipped on purpose\r
+ //\r
case 'd':\r
if ((Flags & LONG_TYPE) == 0) {\r
//\r
- // 'd','x', and 'X' that are not preceded by 'l' or 'L' are assumed to be type "int".\r
+ // 'd', 'u', 'x', and 'X' that are not preceded by 'l' or 'L' are assumed to be type "int".\r
// This assumption is made so the format string definition is compatible with the ANSI C\r
// Specification for formatted strings. It is recommended that the Base Types be used \r
// everywhere, but in this one case, compliance with ANSI C is more important, and \r
Flags &= ~((UINTN) PREFIX_ZERO);\r
Precision = 1;\r
}\r
- if (Value < 0) {\r
+ if (Value < 0 && (Flags & UNSIGNED_TYPE) == 0) {\r
Flags |= PREFIX_SIGN;\r
Prefix = '-';\r
Value = -Value;\r
+ } else if ((Flags & UNSIGNED_TYPE) != 0 && (Flags & LONG_TYPE) == 0) {\r
+ //\r
+ // 'd', 'u', 'x', and 'X' that are not preceded by 'l' or 'L' are assumed to be type "int".\r
+ // This assumption is made so the format string definition is compatible with the ANSI C\r
+ // Specification for formatted strings. It is recommended that the Base Types be used \r
+ // everywhere, but in this one case, compliance with ANSI C is more important, and \r
+ // provides an implementation that is compatible with that largest possible set of CPU \r
+ // architectures. This is why the type "unsigned int" is used in this one case.\r
+ //\r
+ Value = (unsigned int)Value;\r
}\r
} else {\r
Radix = 16;\r
Comma = FALSE;\r
if ((Flags & LONG_TYPE) == 0 && Value < 0) {\r
//\r
- // 'd','x', and 'X' that are not preceded by 'l' or 'L' are assumed to be type "int".\r
+ // 'd', 'u', 'x', and 'X' that are not preceded by 'l' or 'L' are assumed to be type "int".\r
// This assumption is made so the format string definition is compatible with the ANSI C\r
// Specification for formatted strings. It is recommended that the Base Types be used \r
// everywhere, but in this one case, compliance with ANSI C is more important, and \r