From: Andrew Morton Date: Wed, 25 Apr 2012 01:03:56 +0000 (+1000) Subject: vsprintf-further-optimize-decimal-conversion-checkpatch-fixes X-Git-Tag: next-20120430~2^2~87 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=3b464d2e1903599feab008067749fc910cd5a27c;p=karo-tx-linux.git 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 --- 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; }