From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb29.google.com (mail-yb1-xb29.google.com [IPv6:2607:f8b0:4864:20::b29]) by sourceware.org (Postfix) with ESMTPS id B53F33857358 for ; Thu, 14 Apr 2022 14:56:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B53F33857358 Received: by mail-yb1-xb29.google.com with SMTP id g34so9934960ybj.1 for ; Thu, 14 Apr 2022 07:56:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zHxDgJz93CFrQqJAOa/0c6AhsrwW6Wf4HTtyKzpnj2g=; b=wqMEyaOT0WVwWkbWkkqGFJI3PGsoT3v0vg6JyBzHLD9njqtXLSSwuwwB8OQ66rw8sz zBtrC/5XSyHoTxLgMpZhInAzj81i1bmnwQTGmOnCdgWXA5u3BDXG7J7Lq9N0JD7d+aky 6bHQm1V2RkO2TaBANKattEpKGJwuQTBl8yE2IYwAQwJcxJOsAy63uq5YKeZ60QvctaiZ SHEe68kuCnmvwL2GvibytQaNhrHFr5+DrdoiGe3lDyCdt6C4spIFS2yBIPLB7k9EvUx9 5QPi2XLrse8oIeIHcDS3iXOrwEH2wa6jYnyqWm13dxcbXpVxY9pbZX2BllkE/lrl/xJF IOwA== X-Gm-Message-State: AOAM533rarnxsYFIp7qTv2NiXH9B4BuQSMb7MS0tA7AfaaKVKiJXu1Dm PS//gXWpc9QZDIlqsyd341sQljaNevt+Zc+Y9gE= X-Google-Smtp-Source: ABdhPJwwesNhIcreObiQA4gxkPiYht4mx4NQz8f48B2nF6fPMIJUnJhYygZr74dLhkIWc0q6cCxepwqJ224ohmWtcSs= X-Received: by 2002:a25:d0c4:0:b0:641:dd06:8490 with SMTP id h187-20020a25d0c4000000b00641dd068490mr1916236ybg.611.1649948185104; Thu, 14 Apr 2022 07:56:25 -0700 (PDT) MIME-Version: 1.0 References: <20220414041231.926415-1-goldstein.w.n@gmail.com> In-Reply-To: From: Noah Goldstein Date: Thu, 14 Apr 2022 09:56:14 -0500 Message-ID: Subject: Re: [PATCH v1 1/6] elf: Refactor dl_new_hash so it can be tested / benchmarked To: "H.J. Lu" Cc: GNU C Library , "Carlos O'Donell" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Apr 2022 14:56:28 -0000 On Wed, Apr 13, 2022 at 11:32 PM H.J. Lu wrote: > > On Wed, Apr 13, 2022 at 9:12 PM Noah Goldstein wrote: > > > > No change to the code other than moving it to > > sysdeps/generic/dl-hash.h. Changed name so its now in the > > reserved namespace. > > --- > > sysdeps/generic/dl-hash.h | 13 +++++++++++++ > > sysdeps/i386/i686/dl-hash.h | 3 +++ > > 2 files changed, 16 insertions(+) > > > > diff --git a/sysdeps/generic/dl-hash.h b/sysdeps/generic/dl-hash.h > > index 9bc7e3bd67..c041074352 100644 > > --- a/sysdeps/generic/dl-hash.h > > +++ b/sysdeps/generic/dl-hash.h > > @@ -19,7 +19,9 @@ > > #ifndef _DL_HASH_H > > #define _DL_HASH_H 1 > > > > +#include > > > > +#ifndef __HAS_DL_ELF_HASH > > /* This is the hashing function specified by the ELF ABI. In the > > first five operations no overflow is possible so we optimized it a > > bit. */ > > @@ -71,5 +73,16 @@ _dl_elf_hash (const char *name_arg) > > } > > return hash; > > } > > +#endif /* !__HAS_DL_ELF_HASH */ > > + > > +static uint32_t > > +__dl_new_hash (const char *s) > > I think this should be put in a new header file, dl-new-hash.h, and rename > the function to _dl_new_hash. Fixed in v2. > > > +{ > > + uint32_t h = 5381; > > + for (unsigned char c = *s; c != '\0'; c = *++s) > > + h = h * 33 + c; > > + return h; > > +} > > + > > > > #endif /* dl-hash.h */ > > diff --git a/sysdeps/i386/i686/dl-hash.h b/sysdeps/i386/i686/dl-hash.h > > index c124480e77..d18370350d 100644 > > --- a/sysdeps/i386/i686/dl-hash.h > > +++ b/sysdeps/i386/i686/dl-hash.h > > @@ -75,4 +75,7 @@ _dl_elf_hash (const char *name) > > return result; > > } > > > > +#define __HAS_DL_ELF_HASH 1 > > +#include > > + > > #endif /* dl-hash.h */ > > -- > > 2.25.1 > > > > > -- > H.J.