Re: [PATCH] cciss: Fix warnings during compilation under 32bitenvironment

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andrew Morton
Date: Friday, April 20, 2007 - 2:12 pm

On Fri, 20 Apr 2007 16:20:59 -0400
James Bottomley <James.Bottomley@SteelEye.com> wrote:


bummer.


That works if we know the caller is treating the return value as 32 bits,
but we don't know that.

If we have

#define upper_32_bits(x)  ((x >> 16) >> 16)

then

	upper_32_bits(0x8888777766665555)

will return 0x88887777 if it's treated as 32-bits, but it'll return
0xffffffff88887777 if the caller is using 64-bits.

I spose

#define upper_32_bits(x)  ((u32)((x >> 16) >> 16))

will do the trick.


-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] cciss: Fix warnings during compilation under 3 ..., Andrew Morton, (Fri Apr 20, 2:12 pm)
Re: [PATCH] cciss: Fix warnings during compilation under 3 ..., John Anthony Kazos Jr., (Fri Apr 20, 2:39 pm)
[PATCH] utilities: add helper functions for safe 64-bit in ..., John Anthony Kazos Jr., (Fri Apr 20, 5:55 pm)
Re: [PATCH] utilities: add helper functions for safe 64-bi ..., John Anthony Kazos Jr., (Sat Apr 21, 6:06 am)
Re: [PATCH] utilities: add helper functions for safe 64-bi ..., Christoph Hellwig, (Sun Apr 22, 2:18 am)
Re: [PATCH] utilities: add helper functions for safe 64-bi ..., Christoph Hellwig, (Sun Apr 22, 5:35 am)