From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by sourceware.org (Postfix) with ESMTPS id EE1DA3858D32 for ; Mon, 16 Jan 2023 20:58:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EE1DA3858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-pl1-x629.google.com with SMTP id jn22so31439290plb.13 for ; Mon, 16 Jan 2023 12:58:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=7zJJP7rm/aKcWGANX+mAa3rcL9CBqnnRCrgygny1Q1c=; b=hzkFnjlkJOWJRFitZbwx5CmnXbYh2eCvOTaidTD/j6mTDDqFRggt+diO+3t1Oa9nmG ES7H1sV/k0g5Tx4UzRgywcV2GeeFLiGF5OpYm2knLAEH0Qb1Q0zwrHn1zQ+UaPcfyaFG vwKxE2VgT/Yda9eXNSgiZvgxC+lgzyZNScWKsfHDWPapY9NZB840HhOmh2eMTpt6Nrf8 ZBidu1IKWnAfvoR76p0lq32epUi2ge5R+EQqDQId+u6i+RayhWq4I6zcQiSXpvIptDkd /K3JMhTGIIQAUfOl4+IEl2BN9FjBhUSYrJ/fpgmPNUPg7OEJQ5vkjY4HqwmRTFp+M/Yj 2osg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7zJJP7rm/aKcWGANX+mAa3rcL9CBqnnRCrgygny1Q1c=; b=4fkXqd4IaQc58+MMLLxTEjIhg3Fgh2vB+m3TQ7A/D6WXv15YV2SxmYgRxBVKom/VYn cIHiQzs0Z6dEqjbhvRJo7qxf+dlVZsbFAMB7byAhCgIKPxev6OJsHp/RtvM3bXy1T+ur q/Rxv82DpelWF/aPYR4K8Dee4G5G5Smf+vzGrJcGKAycCDxMKGuUZEDrpd3eAyp0pwkX t5ClYF3hjvajcAARDeFNT16hPZ6lkX7tZy7amQd6+LhQqmy3I8hhz9sskOdD2z2IjDFW R+f5zbEh08prKZ9eJD7hg7VKZrsZj7vXQVugatFprjHslKYgHOk0O1v3R00ThJJN3vgu ssTg== X-Gm-Message-State: AFqh2kprKRApedFYGUIk5Em983PSTTsrESO3kV6yErseZHqG0CmY2BXD FCvh+CIwu/parpVfV+Aj87WsNe7+9QxCJubL X-Google-Smtp-Source: AMrXdXuKxSdshwJN6urYD++17NNEkr63PaLmYJxTx18bNybL9JX7HcWvQrd/6oeCFJwyO9xnDJnMkQ== X-Received: by 2002:a05:6a20:be05:b0:b8:828c:d373 with SMTP id ge5-20020a056a20be0500b000b8828cd373mr249818pzb.40.1673902731985; Mon, 16 Jan 2023 12:58:51 -0800 (PST) Received: from [192.168.5.146] (rrcs-173-198-77-218.west.biz.rr.com. [173.198.77.218]) by smtp.gmail.com with ESMTPSA id x73-20020a62864c000000b0058d8f23af26sm3618571pfd.157.2023.01.16.12.58.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 Jan 2023 12:58:51 -0800 (PST) Message-ID: <6bea5a76-09b2-b761-310b-7b378a3af64b@linaro.org> Date: Mon, 16 Jan 2023 10:58:48 -1000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v8 03/17] Add string-maskoff.h generic header Content-Language: en-US From: Richard Henderson To: libc-alpha@sourceware.org Cc: adhemerval.zanella@linaro.org, goldstein.w.n@gmail.com References: <20230113182733.1268668-1-richard.henderson@linaro.org> <20230113182733.1268668-4-richard.henderson@linaro.org> In-Reply-To: <20230113182733.1268668-4-richard.henderson@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 1/13/23 08:27, Richard Henderson wrote: > +/* Provide a mask based on the pointer alignment that sets up non-zero > + bytes before the beginning of the word. It is used to mask off > + undesirable bits from an aligned read from an unaligned pointer. > + For instance, on a 64 bits machine with a pointer alignment of > + 3 the function returns 0x0000000000ffffff for LE and 0xffffff0000000000 > + (meaning to mask off the initial 3 bytes). */ > +static __always_inline op_t > +create_mask (uintptr_t i) > +{ > + i = i % sizeof (op_t); > + if (__BYTE_ORDER == __LITTLE_ENDIAN) > + return ~(((op_t)-1) << (i * CHAR_BIT)); > + else > + return ~(((op_t)-1) >> (i * CHAR_BIT)); > +} This has exactly one use, in strlen, which could now use shift_find, like strchrnul. > +/* Based on mask created by 'create_mask', mask off the high bit of each > + byte in the mask. It is used to mask off undesirable bits from an > + aligned read from an unaligned pointer, and also taking care to avoid > + match possible bytes meant to be matched. For instance, on a 64 bits > + machine with a mask created from a pointer with an alignment of 3 > + (0x0000000000ffffff) the function returns 0x7f7f7f0000000000 for BE > + and 0x00000000007f7f7f for LE. */ > +static __always_inline op_t > +highbit_mask (op_t m) > +{ > + return m & repeat_bytes (0x7f); > +} This isn't used at all anymore. If we remove those two, we're left with repeat_byte and word_containing, which are used, but no longer seem to fit the filename of string-maskoff,h, though I can't immediately think of something better to use. r~