lkml.org 
[lkml]   [2015]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH 3.12 065/122] lib/checksum.c: fix carry in csum_tcpudp_nofold
Date
> +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




\
 
 \ /
  Last update: 2015-02-17 13:21    [W:0.533 / U:1.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site