]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
vsprintf-further-optimize-decimal-conversion-checkpatch-fixes
authorAndrew Morton <akpm@linux-foundation.org>
Wed, 25 Apr 2012 01:03:56 +0000 (11:03 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 30 Apr 2012 05:17:30 +0000 (15:17 +1000)
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 <vda.linux@googlemail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/vsprintf.c

index c7e8563f8a374190059c168e45fa28aeceb0c347..0563bc9b828444b940aaf37cc7ab281d68e71584 100644 (file)
@@ -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;
 }