aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/vsprintf.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 7a299d43987a..2753f9261115 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -341,10 +341,10 @@ int num_to_str(char *buf, int size, unsigned long long num)
341} 341}
342 342
343#define SIGN 1 /* unsigned/signed, must be 1 */ 343#define SIGN 1 /* unsigned/signed, must be 1 */
344#define ZEROPAD 2 /* pad with zero */ 344#define LEFT 2 /* left justified */
345#define PLUS 4 /* show plus */ 345#define PLUS 4 /* show plus */
346#define SPACE 8 /* space if plus */ 346#define SPACE 8 /* space if plus */
347#define LEFT 16 /* left justified */ 347#define ZEROPAD 16 /* pad with zero, must be 16 == '0' - ' ' */
348#define SMALL 32 /* use lowercase in hex (must be 32 == 0x20) */ 348#define SMALL 32 /* use lowercase in hex (must be 32 == 0x20) */
349#define SPECIAL 64 /* prefix hex with "0x", octal with "0" */ 349#define SPECIAL 64 /* prefix hex with "0x", octal with "0" */
350 350
@@ -467,7 +467,8 @@ char *number(char *buf, char *end, unsigned long long num,
467 } 467 }
468 /* zero or space padding */ 468 /* zero or space padding */
469 if (!(spec.flags & LEFT)) { 469 if (!(spec.flags & LEFT)) {
470 char c = (spec.flags & ZEROPAD) ? '0' : ' '; 470 char c = ' ' + (spec.flags & ZEROPAD);
471 BUILD_BUG_ON(' ' + ZEROPAD != '0');
471 while (--spec.field_width >= 0) { 472 while (--spec.field_width >= 0) {
472 if (buf < end) 473 if (buf < end)
473 *buf = c; 474 *buf = c;