[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6DB025AC14@AcuExch.aculab.com>
Date: Mon, 9 Jan 2017 12:55:43 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Joe Perches' <joe@...ches.com>,
Jeff Kirsher <jeffrey.t.kirsher@...el.com>
CC: Julia Lawall <julia.lawall@...6.fr>,
"intel-wired-lan@...ts.osuosl.org" <intel-wired-lan@...ts.osuosl.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [RFC PATCH] intel: Use upper_32_bits and lower_32_bits
From: Joe Perches
> Sent: 07 January 2017 18:33
> Shifting and masking various types can be made a bit
> simpler to read by using the available kernel macros.
...
> - ew32(TDBAH, (tdba >> 32));
> - ew32(TDBAL, (tdba & 0x00000000ffffffffULL));
> + ew32(TDBAH, upper_32_bits(tdba));
> + ew32(TDBAL, lower_32_bits(tdba));
Personally I find the original code easier to understand
since I don't have to look up another silly macro.
I'd normally not even explicitly mask the low bits
relying on the implicit truncation of the assignment.
At least modern compilers aren't stupid enough to add two
'mask with 0xff' instructions for:
*uchar_ptr = (unsigned char)(foo & 0xff);
David
Powered by blists - more mailing lists