Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757455AbbBQME4 (ORCPT ); Tue, 17 Feb 2015 07:04:56 -0500 Received: from smtp-out6.electric.net ([192.162.217.187]:50013 "EHLO smtp-out6.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751905AbbBQMEw convert rfc822-to-8bit (ORCPT ); Tue, 17 Feb 2015 07:04:52 -0500 From: David Laight To: "'Jiri Slaby'" , "stable@vger.kernel.org" CC: "linux-kernel@vger.kernel.org" , karl beldan , Karl Beldan , Al Viro , Eric Dumazet , "Arnd Bergmann" , Mike Frysinger , "netdev@vger.kernel.org" , Eric Dumazet , "David S. Miller" Subject: RE: [PATCH 3.12 065/122] lib/checksum.c: fix carry in csum_tcpudp_nofold Thread-Topic: [PATCH 3.12 065/122] lib/checksum.c: fix carry in csum_tcpudp_nofold Thread-Index: AQHQSqf2r4Yt5njhk0WOADDrBdERHpz0vYNg Date: Tue, 17 Feb 2015 12:04:22 +0000 Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1CAE4D1E@AcuExch.aculab.com> References: <07707a797d6c3cd0bfe86f037d3d1eb329acbc86.1424099973.git.jslaby@suse.cz> In-Reply-To: <07707a797d6c3cd0bfe86f037d3d1eb329acbc86.1424099973.git.jslaby@suse.cz> 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-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 643 Lines: 23 > +static inline u32 from64to32(u64 x) > +{ > + /* add up 32-bit and 32-bit for 32+c bit */ > + x = (x & 0xffffffff) + (x >> 32); > + /* add up carry.. */ > + x = (x & 0xffffffff) + (x >> 32); > + return (u32)x; > +} As a matter of interest, does the compiler optimise away the second (x & 0xffffffff) ? The code could just be: x = (x & 0xffffffff) + (x >> 32); return x + (x >> 32); David -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/