From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7998 Path: news.gmane.org!not-for-mail From: Alexander Monakov Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH 5/5] dynlink.c: use a faster expression in gnu_hash Date: Wed, 24 Jun 2015 02:24:55 +0300 Message-ID: <1435101895-18240-6-git-send-email-amonakov@ispras.ru> References: <1435101895-18240-1-git-send-email-amonakov@ispras.ru> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1435107364 14316 80.91.229.3 (24 Jun 2015 00:56:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 24 Jun 2015 00:56:04 +0000 (UTC) Cc: Alexander Monakov To: musl@lists.openwall.com Original-X-From: musl-return-8011-gllmg-musl=m.gmane.org@lists.openwall.com Wed Jun 24 02:56:02 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Z7Yyw-0004LU-HQ for gllmg-musl@m.gmane.org; Wed, 24 Jun 2015 02:56:02 +0200 Original-Received: (qmail 24383 invoked by uid 550); 24 Jun 2015 00:55:59 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 3955 invoked from network); 23 Jun 2015 23:25:40 -0000 X-Mailer: git-send-email 2.1.4 In-Reply-To: <1435101895-18240-1-git-send-email-amonakov@ispras.ru> Xref: news.gmane.org gmane.linux.lib.musl.general:7998 Archived-At: With -Os, GCC uses a multiply rather than a shift and addition for 'h*33'. Use a more efficient expression explicitely. --- src/ldso/dynlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c index 99be7d0..f7342cd 100644 --- a/src/ldso/dynlink.c +++ b/src/ldso/dynlink.c @@ -217,7 +217,7 @@ static uint32_t gnu_hash(const char *s0) const unsigned char *s = (void *)s0; uint_fast32_t h = 5381; for (; *s; s++) - h = h*33 + *s; + h += h*32 + *s; return h; }