From: "H. Peter Anvin" <hpa@zytor.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: joerg.roedel@amd.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] introduce lower_32_bits() macro
Date: Fri, 25 Jul 2008 16:54:45 -0400 [thread overview]
Message-ID: <488A3D95.20108@zytor.com> (raw)
In-Reply-To: <20080725134759.ae19b883.akpm@linux-foundation.org>
Andrew Morton wrote:
>>> */
>>> #define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
>>>
>>> +/**
>>> + * lower_32_bits - return bits 0-31 of a number
>>> + * @n: the number we're accessing
>>> + */
>>> +#define lower_32_bits(n) ((n) & 0xffffffffULL)
>>> +
>> NAK. These are assymmetric with regards to type, which is the *last*
>> thing we want.
>
> Yes, it will convert a 32-bit expression into a 64-bit one.
>
Sort of. upper_32_bits() takes a 32- or 64-bit expression, and delivers
the upper 32 bits *as a 32-bit number*. An equivalent expression would be:
((u32)((u64)(n) >> 32))
... which might actually produce better code, for all I know.
Logically speaking, if we have a lower_32_bits() macro, it should also
produce a 32-bit type as result.
-hpa
next prev parent reply other threads:[~2008-07-25 20:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-25 15:12 [PATCH] introduce lower_32_bits() macro Joerg Roedel
2008-07-25 16:06 ` H. Peter Anvin
2008-07-25 20:47 ` Andrew Morton
2008-07-25 20:54 ` Roland Dreier
2008-07-25 21:39 ` H. Peter Anvin
2008-07-25 20:54 ` H. Peter Anvin [this message]
2008-07-28 10:59 ` Joerg Roedel
2008-07-28 12:07 ` Joerg Roedel
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=488A3D95.20108@zytor.com \
--to=hpa@zytor.com \
--cc=akpm@linux-foundation.org \
--cc=joerg.roedel@amd.com \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.