Re: [tip:x86/mce] x86/bitops: Move BIT_64() for a wider use
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Subject: Re: [tip:x86/mce] x86/bitops: Move BIT_64() for a wider use
- From: Borislav Petkov <bp@xxxxxxxxx>
- Date: Wed, 23 May 2012 18:53:03 +0200
- Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>, Borislav Petkov <borislav.petkov@xxxxxxx>, mingo@xxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, frank.arnold@xxxxxxx, akpm@xxxxxxxxxxxxxxxxxxxx, torvalds@xxxxxxxxxxxxxxxxxxxx, tglx@xxxxxxxxxxxxx, linux-tip-commits@xxxxxxxxxxxxxxx
- In-reply-to: <4FBD10D5.6080602@zytor.com>
- Mail-followup-to: Borislav Petkov <bp@xxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>, Borislav Petkov <borislav.petkov@xxxxxxx>, mingo@xxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, frank.arnold@xxxxxxx, akpm@xxxxxxxxxxxxxxxxxxxx, torvalds@xxxxxxxxxxxxxxxxxxxx, tglx@xxxxxxxxxxxxx, linux-tip-commits@xxxxxxxxxxxxxxx
- User-agent: Mutt/1.5.21 (2010-09-15)
On Wed, May 23, 2012 at 09:31:17AM -0700, H. Peter Anvin wrote:
> >>
> >> Actually we need a BIT() macro that works both
> >> on 32- and 64-bit. But that won't be that easy:
> >> http://lkml.indiana.edu/hypermail/linux/kernel/1010.1/02335.html
> >>
> >> And it should return UL for shift values < 32 and ULL otherwise.
> >
>
> Why do you want that behavior? That seems bizarre...
I forgot to say "on 32-bit" above. So the sentence should've been:
"And it should return UL for shift values < 32 and ULL otherwise on
32-bit."
How about the following completely untested chunk:
#ifdef CONFIG_64BIT
#define BIT(nr) (UC_64(1) << (nr))
#else
#define BIT(nr) \
({ \
unsigned _shift = (nr); \
((_shift > 32) ? (U64_C(1) << _shift) : (U32_C(1) << _shift)); \
})
#endif
Ok? Too ugly? It still changes the return type of unsigned long to ULL
for shift values >= 32 and probably Linus doesn't want that...
Hmm.
--
Regards/Gruss,
Boris.
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Index of Archives]
[Linux Stable Commits]
[Linux Stable Kernel]
[Linux Kernel]
[Linux USB Devel]
[Linux Video &Media]
[Linux Audio Users]
[Yosemite News]
[Linux SCSI]