From: André Goddard Rosa Date: Tue, 15 Dec 2009 02:00:59 +0000 (-0800) Subject: vsprintf: reduce code size by avoiding extra check X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b5ff992b09dbe06a4a020fbb702e29ab61290cc5;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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: André Goddard Rosa Acked-by: Frederic Weisbecker Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/lib/vsprintf.c b/lib/vsprintf.c index cba2385a6f0b..4819c3d6cca4 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -797,8 +797,9 @@ static char *ip6_compressed_string(char *p, const char *addr) p = pack_hex_byte(p, hi); else *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); else *p++ = hex_asc_lo(lo);