From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x2f.google.com (mail-oa1-x2f.google.com [IPv6:2001:4860:4864:20::2f]) by sourceware.org (Postfix) with ESMTPS id 96BD83858D28 for ; Tue, 17 Jan 2023 18:49:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 96BD83858D28 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-oa1-x2f.google.com with SMTP id 586e51a60fabf-15085b8a2f7so32977659fac.2 for ; Tue, 17 Jan 2023 10:49:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=jWnXJbr7gawZYwufzVbURb5VdjV+VbZ2JLvbE8apQRY=; b=oym/3Bs4iq3GgcsikitMe10yS04ZjA1F0IXbuKtdem968MF6isaFC1Z7npFMP6jKTM NiAcyU2XMpG4BPUqzdoaBihl5ENwNHoOB0V7o3ZGKRv3eDILSl2V3TXJV3VWoNR0l0Ag KKVsH0Xlb0tHHKF1kSN9EUeB2SrmYQEvVK/UKD8BHwv8DWuwOs5VXRZcJIPbdi8MmRMk LQTajJC8R4N2Z4vBJCGAzd92Dxkdi+AN6xUqE+aXwFThDuXzQ59LZX1WZGlPli6rnESX rQ0H70NjnpHIhWnwB1Gghgdq0CScCHYeqnc2eWAAxpT81RMoIOUouDbT/mKiz+RXfoCl cqqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jWnXJbr7gawZYwufzVbURb5VdjV+VbZ2JLvbE8apQRY=; b=TZ4oPb3ByaaWumEJ6+A/dzsFuI8f8XF4wKBklueDmKziVE8/hzLPMxPmUbY3LYz4eA kFJyYMMzqDAkTIjWDpC8YFEQakl+XhjJdGdioOOWR1o1WmIOgvFq96wM9RVjZBiDm+nf iEOWTAmwYZHtV8/b86KKVfH14Gn53hEkgxSIEOM34KZelxSLC7EuO9wesCMf4b66lXIS p3bc+hqeEOe9GPF7dTlYJuftySdF1xjO73EazHToGIaNYp3oV3jcJlrBGJPikVNlRkl2 1yQH9BqNiPHYd981iv2lIHMwvYg4WAAE9EMkyAqXjbMGvAhdrs7cjgbQhtH+YGyMFy+5 v3CA== X-Gm-Message-State: AFqh2kq5kFJ3Huk8k5cT+niSqtJNeVBtmrptY/Hl5ZeUeFVSCcp9rKjt MPabmT71IyjI2kwoxbqjGcwQbg== X-Google-Smtp-Source: AMrXdXvwjuT/4q9jdls3NeP1FmOs+g3XZmhoWlStWMKmoIu4Kq/h1VPzc3dO8M4o5Zk/rs1IpiF+mQ== X-Received: by 2002:a05:6870:e86:b0:15e:e89c:fec3 with SMTP id mm6-20020a0568700e8600b0015ee89cfec3mr2465962oab.28.1673981386213; Tue, 17 Jan 2023 10:49:46 -0800 (PST) Received: from ?IPV6:2804:1b3:a7c1:1652:49fa:2dd7:dbd:38f6? ([2804:1b3:a7c1:1652:49fa:2dd7:dbd:38f6]) by smtp.gmail.com with ESMTPSA id r10-20020a05687032ca00b0014ff15936casm16760107oac.40.2023.01.17.10.49.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Jan 2023 10:49:45 -0800 (PST) Message-ID: Date: Tue, 17 Jan 2023 15:49:42 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH v8 03/17] Add string-maskoff.h generic header Content-Language: en-US To: Richard Henderson , libc-alpha@sourceware.org Cc: goldstein.w.n@gmail.com References: <20230113182733.1268668-1-richard.henderson@linaro.org> <20230113182733.1268668-4-richard.henderson@linaro.org> <6bea5a76-09b2-b761-310b-7b378a3af64b@linaro.org> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: <6bea5a76-09b2-b761-310b-7b378a3af64b@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.3 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 16/01/23 17:58, Richard Henderson wrote: > 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. Right, I remove the strlen usage then. > >> +/* 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. The word_containing can be removed as well in favor of PTR_ALIGN macros and I will rename the header to string-repeat_bytes.h.