From: Randolph Chung <randolph@tausq.org>
To: Matt Turner <mattst88@gmail.com>
Cc: Roel Kluin <roel.kluin@gmail.com>,
kyle@mcmartin.ca, linux-parisc@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] misplaced parenthesis?
Date: Mon, 18 May 2009 09:42:50 +0800 [thread overview]
Message-ID: <4A10BD1A.3060208@tausq.org> (raw)
In-Reply-To: <b4198de60905152248t63514a4fmfa71f3a72d80770e@mail.gmail.com>
The wrong version of course produces different code....
the original and the corrected one may produce different code depending
on how the compiler schedules things.
randolph
Matt Turner wrote:
> Does gcc produce different code for the three variations?
>
> Matt
>
> On Sat, May 16, 2009 at 12:14 AM, Randolph Chung <randolph@tausq.org> wrote:
>
>> This is a bit confusingly written, but your patch does not appear to be
>> correct.
>>
>> == has higher precedence than &, so you are basically changing it to:
>> if (likely(t1 & 1))
>>
>> it really should be
>>
>> - if (likely(t1 & (sizeof(unsigned int)-1)) == 0) {
>> + if (likely((t1 & (sizeof(unsigned int)-1)) == 0)) {
>>
>> randolph
>>
>>
>> Roel Kluin wrote:
>>
>>> Fix misplaced parenthesis.
>>>
>>> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
>>> ---
>>> I think this is what was intended? Note that this patch may affect
>>> profiling.
>>>
>>> diff --git a/arch/parisc/lib/memcpy.c b/arch/parisc/lib/memcpy.c
>>> index bbda909..30207b0 100644
>>> --- a/arch/parisc/lib/memcpy.c
>>> +++ b/arch/parisc/lib/memcpy.c
>>> @@ -405,7 +405,7 @@ byte_copy:
>>> unaligned_copy:
>>> /* possibly we are aligned on a word, but not on a double... */
>>> - if (likely(t1 & (sizeof(unsigned int)-1)) == 0) {
>>> + if (likely(t1 & (sizeof(unsigned int)-1) == 0)) {
>>> t2 = src & (sizeof(unsigned int) - 1);
>>> if (unlikely(t2 != 0)) {
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>>
>>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2009-05-18 1:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-15 19:23 [PATCH] misplaced parenthesis? Roel Kluin
2009-05-16 4:14 ` Randolph Chung
2009-05-16 5:48 ` Matt Turner
2009-05-18 1:42 ` Randolph Chung [this message]
2009-06-23 14:53 ` Randolph Chung
2009-06-25 20:29 ` Andrew Morton
2009-06-26 1:38 ` Randolph Chung
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A10BD1A.3060208@tausq.org \
--to=randolph@tausq.org \
--cc=akpm@linux-foundation.org \
--cc=kyle@mcmartin.ca \
--cc=linux-parisc@vger.kernel.org \
--cc=mattst88@gmail.com \
--cc=roel.kluin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox