From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by sourceware.org (Postfix) with ESMTP id 3647E3858D34 for ; Fri, 3 Jul 2020 12:57:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3647E3858D34 Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-234-8A-s0Y-hMPaM2tJHPEYwZA-1; Fri, 03 Jul 2020 08:57:48 -0400 X-MC-Unique: 8A-s0Y-hMPaM2tJHPEYwZA-1 Received: by mail-qv1-f70.google.com with SMTP id j18so20585625qvk.1 for ; Fri, 03 Jul 2020 05:57:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=wiJ5DWSenS4aV8Lzo6uxiPwYW96OdODbXTDknd1HIw8=; b=qJBdA3qRBZgOmt3R406aMb0cPKLf8YbBxxrMeWxzHm7Ny+S5VHhyFyaPsmrcC7OhIr uproVvxpGz1PWnrIySzqKaPb6ikzs6kfpJ75KKImodkKhy8ejJ5naUrbZQiGSM/K2H1H q1tgrHjOY2MgNcs4jo6qj7sW6us7wb390VSuLr9T5EbCDz0giE6/lY0JqfnRTDBSbQeZ gd/bV+vwJ4L7AXc4oL3gPrl8MoxBy9cwptLxRqaoIeVC72bRupGBS85j3+DQDVAnzD2E /dDTlqOuWcKMEjH+dK/YCw6ivodByx6JdVCMEesdHfCibErKypvE68MZOexlxplc162x MdVA== X-Gm-Message-State: AOAM530GKscOSsXuO5m2yKXqbTa/IpozJtM1vUOXxFHs3kXd+/FbAyYC 50aQANp2OHbDl+vMIKu7YybwFI3pFgi8uBerc8gC9zAnaVeZf9ZQMH5HjcT86fHwTNrPtpAbWNd hT8HWrU5bAoiRdXvP7MF4 X-Received: by 2002:a0c:b246:: with SMTP id k6mr34787667qve.146.1593781067733; Fri, 03 Jul 2020 05:57:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyC84wzuyx/ekdJU6ckXHtjxcLfd+53NenZQ697iEHi8hEgRcNxLW0nSvKSNqSPxZPhrQ4uqQ== X-Received: by 2002:a0c:b246:: with SMTP id k6mr34787653qve.146.1593781067473; Fri, 03 Jul 2020 05:57:47 -0700 (PDT) Received: from [192.168.1.4] (198-84-170-103.cpe.teksavvy.com. [198.84.170.103]) by smtp.gmail.com with ESMTPSA id b53sm11426146qtc.65.2020.07.03.05.57.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Jul 2020 05:57:46 -0700 (PDT) Subject: Re: [PATCH 2/4] : New abstraction for combining NSS modules and NSS actions To: DJ Delorie Cc: libc-alpha@sourceware.org References: From: Carlos O'Donell Organization: Red Hat Message-ID: <7cdebdda-89b1-7f4d-dbfb-1a2b956af29e@redhat.com> Date: Fri, 3 Jul 2020 08:57:45 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Fri, 03 Jul 2020 12:57:51 -0000 On 7/1/20 5:27 PM, DJ Delorie wrote: > I went with this: > > unsigned int bits = actions & NSS_BPL_MASK; > action->action_bits = ( bits > | (bits << (NSS_BPL * 1)) > | (bits << (NSS_BPL * 2)) > | (bits << (NSS_BPL * 3)) > | (bits << (NSS_BPL * 4)) > ); > > Sadly, GCC does not optimize this to a single multiplication, but at > least it's only called when parsing a new /etc/nsswitch.conf so > performance here isn't critical. Right, in this core code that occassionally called we have maintenance as our primary concern. I like the above. It's more clear and shows we are setting the NSS bits per lookup across 4 actions. -- Cheers, Carlos.