From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x34.google.com (mail-oa1-x34.google.com [IPv6:2001:4860:4864:20::34]) by sourceware.org (Postfix) with ESMTPS id 9F4FD3858D28 for ; Wed, 18 Jan 2023 12:42:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9F4FD3858D28 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-x34.google.com with SMTP id 586e51a60fabf-15f83e0fc63so1860109fac.11 for ; Wed, 18 Jan 2023 04:42:42 -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 :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=yqiH+sRjSX719Nd69Uyw7Yi0W/MZUdZICQnalXfyt6c=; b=nr1TgfQa41m2ACB8PlvrRwK1bKHXqKo9WPrEeEXrsEUzkqIoROsiGqRfX7sqwsqUpY Yu73sHaC5KyMyGlG0fyT0hhhoRrHG2UAwoBo7EVRsMjFIv7UiDwgrcv1GnT0o3OMxumy H6fKtkRtoCGQdPakviP7cVzTgxBxupF6tAY0bUPpAMMO/aESLvZERyLFnUcQEaeuPigJ V+GoF4PFLGGuYsiF+ATjSlU8zynDoY+7+l7345kDq1ntNDrE/dPqxvI08gTSCENRaeEs twIhg1DqooFUPB+u0hXpo3g+UND9N5Hd1ej+fq6xgwvIa9sW0VUWCyWp9Y/iZWzlIp+r JNpQ== 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 :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=yqiH+sRjSX719Nd69Uyw7Yi0W/MZUdZICQnalXfyt6c=; b=UfJi9tcPbCbIxJ3wiY6mVqEdeTG2dLoPTBelSASSz0D1jIT0BWA8OjPFE5YSKKx/64 5/Fv4bNJw+TBBDgxRW9mnP6hqvF7yNF02Eyv3MRTKhw74UNjHGScL4+kTQE/7EKPYwuU SY/WBlVnoPs/9QmJhyI0QoUzLDEUgp6IT/7m3XtmKvvN3LqBjwDdVtc8XBgcnMdIK+jL TMjjQwPrBrhizC71Xr/VjbGIUtMdC9rUti5jqNhmEpkYtoVbb4T2v3h0yTt/E7sOq7Jm PGJmllr/mWIxZNdlYDHvdx/IKuq47x8sNphClIJIBJC+Pw+MqS6Vf/LVaUFVi25M5OWv Cewg== X-Gm-Message-State: AFqh2kozQtSfWvkywZ7znChVMBWzKdOKf6vOnccGuzjBvPI4Jd9JXvNJ Yg6pVl/fbijjgbBFf2A2AWIpHHm1/D5UvkA4Djg= X-Google-Smtp-Source: AMrXdXsY4YEvyPmI9Rybi+oemBHW5E1UcEvGG+OMUzgqZQpqf0rJMRAG0bc1GJCn7aCwvBIaRpPzxA== X-Received: by 2002:a05:6870:9d92:b0:15f:504c:2bb1 with SMTP id pv18-20020a0568709d9200b0015f504c2bb1mr3662556oab.13.1674045761503; Wed, 18 Jan 2023 04:42:41 -0800 (PST) Received: from ?IPV6:2804:1b3:a7c1:5a35:8035:b8f0:ac9e:a477? ([2804:1b3:a7c1:5a35:8035:b8f0:ac9e:a477]) by smtp.gmail.com with ESMTPSA id k19-20020a056870571300b00150aca072e8sm18105029oap.38.2023.01.18.04.42.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Jan 2023 04:42:40 -0800 (PST) Message-ID: <72f3c219-cec1-b1ff-48e1-580b4f960070@linaro.org> Date: Wed, 18 Jan 2023 09:42:38 -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 v9 03/22] Add string vectorized find and detection functions Content-Language: en-US To: Richard Henderson , libc-alpha@sourceware.org, Noah Goldstein References: <20230117200014.1299923-1-adhemerval.zanella@linaro.org> <20230117200014.1299923-4-adhemerval.zanella@linaro.org> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.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 17/01/23 22:54, Richard Henderson wrote: > On 1/17/23 09:59, Adhemerval Zanella wrote: >> +/* Mask off the bits defined the the S alignment value.  */ >> +static __always_inline find_t >> +shift_find_last (find_t word, uintptr_t s) >> +{ >> +  s = s % sizeof (op_t); >> +  if (__BYTE_ORDER == __LITTLE_ENDIAN) >> +    return word & ~(((op_t)-1) << (s * CHAR_BIT)); >> +  else >> +    return word & ~(((op_t)-1) >> (s * CHAR_BIT)); >> +} > > Isn't this wrong for s % sizeof == 0? Yes, but on strrchr I called it only for s != 0. Not sure which is the best option here.