Commit b5ff992b authored by André Goddard Rosa's avatar André Goddard Rosa Committed by Linus Torvalds

vsprintf: reduce code size by avoiding extra check

No functional change, just refactor the code so that it avoid checking
"if (hi)" two times in a sequence, taking advantage of previous check made.

It also reduces code size:
   text    data     bss     dec     hex filename
  15726       0       8   15734    3d76 vsprintf.o (ex lib/lib.a-BEFORE)
  15710       0       8   15718    3d66 vsprintf.o (ex lib/lib.a-AFTER)
Signed-off-by: default avatarAndré Goddard Rosa <andre.goddard@gmail.com>
Acked-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 08562cb2
...@@ -797,8 +797,9 @@ static char *ip6_compressed_string(char *p, const char *addr) ...@@ -797,8 +797,9 @@ static char *ip6_compressed_string(char *p, const char *addr)
p = pack_hex_byte(p, hi); p = pack_hex_byte(p, hi);
else else
*p++ = hex_asc_lo(hi); *p++ = hex_asc_lo(hi);
p = pack_hex_byte(p, lo);
} }
if (hi || lo > 0x0f) else if (lo > 0x0f)
p = pack_hex_byte(p, lo); p = pack_hex_byte(p, lo);
else else
*p++ = hex_asc_lo(lo); *p++ = hex_asc_lo(lo);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment