From: "André Goddard Rosa" <andre.goddard@gmail.com>
To: "linux list" <linux-kernel@vger.kernel.org>,
"Andrew Morton" <akpm@linux-foundation.org>
Cc: "André Goddard Rosa" <andre.goddard@gmail.com>
Subject: [PATCH v5 05/12] vsprintf: reduce code size by avoiding extra check
Date: Sat, 14 Nov 2009 05:11:53 -0200 [thread overview]
Message-ID: <f10ae6f99b20a00bfbce030d28992381f034fdf3.1258181837.git.andre.goddard@gmail.com> (raw)
In-Reply-To: <cover.1258181836.git.andre.goddard@gmail.com>
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 <andre.goddard@gmail.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
---
lib/vsprintf.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index d107583..3c83f7b 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -745,8 +745,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);
--
1.6.5.2.180.gc5b3e.dirty
next prev parent reply other threads:[~2009-11-15 7:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-14 7:11 [PATCH v5 00/12] introduce skip_spaces(), reducing code size plus some clean-ups André Goddard Rosa
2009-11-14 7:11 ` [PATCH v5 01/12] vsprintf: factorize "(null)" string André Goddard Rosa
2009-11-14 7:11 ` [PATCH v5 02/12] vsprintf: pre-calculate final string length for later use André Goddard Rosa
2009-11-14 7:11 ` [PATCH v5 03/12] vsprintf: give it some care to please checkpatch.pl André Goddard Rosa
2009-11-14 7:11 ` [PATCH v5 04/12] vsprintf: use TOLOWER whenever possible André Goddard Rosa
2009-11-14 7:11 ` André Goddard Rosa [this message]
2009-11-14 7:11 ` [PATCH v5 06/12] vsprintf: move local vars to block local vars and remove unneeded ones André Goddard Rosa
2009-11-14 7:11 ` [PATCH v5 07/12] vsprintf: factor out skip_space code in a separate function André Goddard Rosa
2009-11-14 7:11 ` [PATCH v5 08/12] vsprintf: reuse almost identical simple_strtoulX() functions André Goddard Rosa
2009-11-14 7:11 ` [PATCH v5 09/12] ctype: constify read-only _ctype string André Goddard Rosa
2009-11-14 7:11 ` [PATCH v5 10/12] string: factorize skip_spaces and export it to be generally available André Goddard Rosa
2009-11-15 19:33 ` Anders Larsen
2009-11-14 7:11 ` [PATCH v5 11/12] string: on strstrip(), first remove leading spaces before running over str André Goddard Rosa
2009-11-14 7:12 ` [PATCH v5 12/12] tree-wide: convert open calls to remove spaces to skip_spaces() lib function André Goddard Rosa
2009-11-16 15:02 ` Henrique de Moraes Holschuh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f10ae6f99b20a00bfbce030d28992381f034fdf3.1258181837.git.andre.goddard@gmail.com \
--to=andre.goddard@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome