From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by sourceware.org (Postfix) with ESMTPS id 3878A3858D28 for ; Wed, 18 Jan 2023 01:54:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3878A3858D28 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-x630.google.com with SMTP id r21so3328583plg.13 for ; Tue, 17 Jan 2023 17:54:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=6WPpBzcy0RO2R5qxOrzh353sctLJZb7BDM+Ah5687hw=; b=klUQWSTZLhBPA+6uiltnjRbupt2B8PD+KeCoiHQB15bRXm8FVsyutBTrIdxCRZ/s76 YzMFnM9mFvhPqLKEeRfpEcZBq+CsSdg3q/b1phsnOtaJqkpzHF7ktYlCNtwkkWBmztc+ PeyZJF+h4utw7E1tkNdKkL4Ix/aVCe6wkZJ310iQ+OH9FPMAgSavVQ9AnVgQTFKsgbzV v4edCqJYdRcIvjjE1AP2+NxVix2QaMqlQFO1FuGdhRs09xyctqdUF0Bt2E59It1v0m2O Lyh2Hrzs8kvpNDENMpiJxADxpuLeW+jnsk4Wo3bSVJbF/wKPPTidpztAXuSJrrCAiWbS 3f3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to: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=6WPpBzcy0RO2R5qxOrzh353sctLJZb7BDM+Ah5687hw=; b=1Jd7RNJG0NqByuMWKKfKsNYUo1Wkc6epT6U7a67ISM3oW7Y4tkIO61KeRjeQHCK2ul rggfR7QYKJAG/1ruTRK/VkofBdJ1YhdDI14R+WFko8s6r9AiLc5RVr+AXosEn4FX8gRc +7G2uO3WvRgBO26+Mww61+Pgzqf162n0vjmjBj/9ishNITtfqf+HgGfivwPdV01l/+aX dGo19L9XO6W8oWAQx0Id0UKkvkA/Zd6bC4F55+CfWtQH8xvtso3DP2YvZlHJQh/aDtqD Ojx3yxgc6+83DP8dSOFQUZGyn5htiIbrQG86YNe068SnhmAZupS5oAMJXTeGq3zUEn6M 8p7Q== X-Gm-Message-State: AFqh2kr3xdpeSlQmQtqjiP32MPG80HaEQjDm95VrsS+GBTZwZWlebvYy yIByI45n4aHKUVSjApzPBi2Zkg== X-Google-Smtp-Source: AMrXdXsGucgzeEKgztWzQjmDxheBg6N9GI+8tSKMn9JbOO8oMw3iftJC5cKpH321Zadv7AfL9M7SPQ== X-Received: by 2002:a05:6a20:d686:b0:b6:5d9f:cd8c with SMTP id it6-20020a056a20d68600b000b65d9fcd8cmr29591157pzb.54.1674006859214; Tue, 17 Jan 2023 17:54:19 -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 w67-20020a636246000000b004cf643a425asm1487530pgb.61.2023.01.17.17.54.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Jan 2023 17:54:18 -0800 (PST) Message-ID: Date: Tue, 17 Jan 2023 15:54:15 -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 v9 03/22] Add string vectorized find and detection functions Content-Language: en-US To: Adhemerval Zanella , libc-alpha@sourceware.org, Noah Goldstein References: <20230117200014.1299923-1-adhemerval.zanella@linaro.org> <20230117200014.1299923-4-adhemerval.zanella@linaro.org> From: Richard Henderson In-Reply-To: <20230117200014.1299923-4-adhemerval.zanella@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.7 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/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? r~