From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S939615AbdAIM4b convert rfc822-to-8bit (ORCPT ); Mon, 9 Jan 2017 07:56:31 -0500 Received: from smtp-out6.electric.net ([192.162.217.189]:60958 "EHLO smtp-out6.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932366AbdAIMzv (ORCPT ); Mon, 9 Jan 2017 07:55:51 -0500 From: David Laight To: "'Joe Perches'" , Jeff Kirsher CC: Julia Lawall , "intel-wired-lan@lists.osuosl.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [RFC PATCH] intel: Use upper_32_bits and lower_32_bits Thread-Topic: [RFC PATCH] intel: Use upper_32_bits and lower_32_bits Thread-Index: AQHSaRR87ed59SCQbEmPKgD0wDA2ZqEwG36w Date: Mon, 9 Jan 2017 12:55:43 +0000 Message-ID: <063D6719AE5E284EB5DD2968C1650D6DB025AC14@AcuExch.aculab.com> References: <7a5cfe63cad3ef4badc30cbc2185a5bfb9250fd8.1483813334.git.joe@perches.com> In-Reply-To: <7a5cfe63cad3ef4badc30cbc2185a5bfb9250fd8.1483813334.git.joe@perches.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.99.200] Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Outbound-IP: 213.249.233.130 X-Env-From: David.Laight@ACULAB.COM X-Proto: esmtps X-Revdns: X-HELO: AcuExch.aculab.com X-TLS: TLSv1:AES128-SHA:128 X-Authenticated_ID: X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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