From patchwork Fri Apr 1 21:34:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 605042 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qcF6K67Kwz9ryQ for ; Sat, 2 Apr 2016 08:35:21 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=ckDmpp3m; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; q=dns; s= default; b=NF8aNm8knqkO0Ief77Ykz1F4r3pM2I39it2MG2+Ke8EQCc2x51Me9 /v7Ng9eCywaSHN7Lla4/i6McgLDVAOuDtByMj9TWTJdYTkJejFGBNEvVNqwEVjkx BpujgcypEqh1bJxTjrQyXtONLyI8Vj8yhUDNT266PZcJqfXv0DmLAM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; s=default; bh=k3E+a51Hl8Ojjy2uz0f7VsP8s9o=; b=ckDmpp3mf0rQsfLbt8zEouIJH2jN 0d76oW78ILdgcAfw1GxEa428JyKOOuU7agubkEes/Or95CVXxniXqmK3kSZ7TaNk KWbNBRClwOZQVoE+MH7B0tIu2cDyuMblzNIewT95wrL9Dl9sJSZdzo5TX1dsZD1g j7wgudha5gffZ00= Received: (qmail 119468 invoked by alias); 1 Apr 2016 21:35:16 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 119440 invoked by uid 89); 1 Apr 2016 21:35:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-yw0-f173.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=ZswIoR9+LosqpzNryHzmGraBOKIt44JT/VlRg3Q/CqI=; b=dTCWduGcLVgBrxVbTpKeLiykIrN6NQ8sDzSyS9a/+WlEfUluKuN39M1ku/E1QDyCz6 K5k6QSunEPXJuLoxcb9QpfSlj6gso/JaoFe7cvLfeMfLdJOLJIjVVNfGVyoCKMsBHi6S RLQlgaoPo+ax4Y9QgqiDgfPf92A6dyNwAfd3BOUcrk6bZXhvyDpSykWLg/EiF+7g716J BnNCG74NNpXESdVHD856CPxVqOwJfz65s7FXDawZLF/htKxiZSoGEmWoqd1bMdtkXzVE lPoWeqgHo94h1HkDpdsdhbsqfs1XQruNsN285adcwimA+Ol0n6t6g6wxaTyt0BgZDzrI 1NnA== X-Gm-Message-State: AD7BkJJlDEdrdtWYCM492KeRC72Zu05iKc2fsQu85k3Hl9hCp3ftpwAd38pSczBv9JhdFdX/ X-Received: by 10.13.226.130 with SMTP id l124mr12082399ywe.294.1459546503072; Fri, 01 Apr 2016 14:35:03 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [COMMITTED] [PATCH] Use PTR_ALIGN_DOWN on strcspn and strspn Date: Fri, 1 Apr 2016 18:34:56 -0300 Message-Id: <1459546496-8831-1-git-send-email-adhemerval.zanella@linaro.org> Following Roland's suggestion. Tested on aarch64. * string/strcspn.c (strcspn): Use PTR_ALIGN_DOWN. * string/strspn.c (strspn): Likewise. --- ChangeLog | 5 +++++ string/strcspn.c | 3 ++- string/strspn.c | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/string/strcspn.c b/string/strcspn.c index c535dd1..0e01193 100644 --- a/string/strcspn.c +++ b/string/strcspn.c @@ -17,6 +17,7 @@ #include #include +#include #undef strcspn @@ -52,7 +53,7 @@ STRCSPN (const char *str, const char *reject) if (p[s[2]]) return 2; if (p[s[3]]) return 3; - s = (unsigned char *) ((uintptr_t)(s) & ~3); + s = (unsigned char *) PTR_ALIGN_DOWN (s, 4); unsigned int c0, c1, c2, c3; do diff --git a/string/strspn.c b/string/strspn.c index f98340b..86f76ea 100644 --- a/string/strspn.c +++ b/string/strspn.c @@ -17,6 +17,7 @@ #include #include +#include #undef strspn #ifndef STRSPN @@ -58,7 +59,8 @@ STRSPN (const char *str, const char *accept) if (!p[s[2]]) return 2; if (!p[s[3]]) return 3; - s = (unsigned char *) ((uintptr_t)(s) & ~3); + s = (unsigned char *) PTR_ALIGN_DOWN (s, 4); + unsigned int c0, c1, c2, c3; do { s += 4;