From 47c9dc0c57e83df74f36a5ba81289a3d97f007e5 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Thu, 3 May 2012 15:44:20 +1000 Subject: [PATCH] vsprintf-further-optimize-decimal-conversion-checkpatch-fixes WARNING: line over 80 characters #112: FILE: lib/vsprintf.c:136: + * (x * 0x00cd) >> 11 x < 1029 shorter code than * 0x67 (on i386) ERROR: trailing statements should be on next line #192: FILE: lib/vsprintf.c:178: + if (q == 0) return buf; ERROR: trailing statements should be on next line #195: FILE: lib/vsprintf.c:181: + if (r == 0) return buf; ERROR: trailing statements should be on next line #198: FILE: lib/vsprintf.c:184: + if (q == 0) return buf; ERROR: trailing statements should be on next line #201: FILE: lib/vsprintf.c:187: + if (r == 0) return buf; ERROR: trailing statements should be on next line #204: FILE: lib/vsprintf.c:190: + if (q == 0) return buf; ERROR: trailing statements should be on next line #207: FILE: lib/vsprintf.c:193: + if (r == 0) return buf; ERROR: trailing statements should be on next line #210: FILE: lib/vsprintf.c:196: + if (q == 0) return buf; ERROR: space prohibited after that '&' (ctx:WxW) #290: FILE: lib/vsprintf.c:267: + d2 = (h ) & 0xffff; ^ ERROR: space prohibited before that close parenthesis ')' #290: FILE: lib/vsprintf.c:267: + d2 = (h ) & 0xffff; total: 9 errors, 1 warnings, 310 lines checked ./patches/vsprintf-further-optimize-decimal-conversion.patch has style problems, please review. If any of these errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. Please run checkpatch prior to sending patches Cc: Denys Vlasenko Signed-off-by: Andrew Morton --- lib/vsprintf.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/vsprintf.c b/lib/vsprintf.c index c7e8563f8a37..0563bc9b8284 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -123,7 +123,8 @@ char *put_dec_full9(char *buf, unsigned q) { unsigned r; - /* Possible ways to approx. divide by 10 + /* + * Possible ways to approx. divide by 10 * (x * 0x1999999a) >> 32 x < 1073741829 (multiply must be 64-bit) * (x * 0xcccd) >> 19 x < 81920 (x < 262149 when 64-bit mul) * (x * 0x6667) >> 18 x < 43699 @@ -175,25 +176,32 @@ char *put_dec_trunc8(char *buf, unsigned r) /* Copy of previous function's body with added early returns */ q = (r * (uint64_t)0x1999999a) >> 32; *buf++ = (r - 10 * q) + '0'; /* 2 */ - if (q == 0) return buf; + if (q == 0) + return buf; r = (q * (uint64_t)0x1999999a) >> 32; *buf++ = (q - 10 * r) + '0'; /* 3 */ - if (r == 0) return buf; + if (r == 0) + return buf; q = (r * (uint64_t)0x1999999a) >> 32; *buf++ = (r - 10 * q) + '0'; /* 4 */ - if (q == 0) return buf; + if (q == 0) + return buf; r = (q * (uint64_t)0x1999999a) >> 32; *buf++ = (q - 10 * r) + '0'; /* 5 */ - if (r == 0) return buf; + if (r == 0) + return buf; q = (r * 0x199a) >> 16; *buf++ = (r - 10 * q) + '0'; /* 6 */ - if (q == 0) return buf; + if (q == 0) + return buf; r = (q * 0xcd) >> 11; *buf++ = (q - 10 * r) + '0'; /* 7 */ - if (r == 0) return buf; + if (r == 0) + return buf; q = (r * 0xcd) >> 11; *buf++ = (r - 10 * q) + '0'; /* 8 */ - if (q == 0) return buf; + if (q == 0) + return buf; *buf++ = q + '0'; /* 9 */ return buf; } -- 2.39.5