lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e00be589-4e9e-48ec-8a25-ad7460f304fa@roeck-us.net>
Date: Thu, 22 Feb 2024 08:04:49 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Charlie Jenkins <charlie@...osinc.com>
Cc: "James E.J. Bottomley" <James.Bottomley@...senpartnership.com>,
	Helge Deller <deller@....de>, Arnd Bergmann <arnd@...db.de>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-parisc@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-arch@...r.kernel.org
Subject: Re: [PATCH 4/4] parisc: checksum: Optimize from32to16

On Wed, Feb 21, 2024 at 06:37:14PM -0800, Charlie Jenkins wrote:
> Replace the shifting and masking of x with a rotation. This generates
> better assembly.
> 
> Signed-off-by: Charlie Jenkins <charlie@...osinc.com>

Tested-by: Guenter Roeck <linux@...ck-us.net>

> ---
>  arch/parisc/lib/checksum.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/parisc/lib/checksum.c b/arch/parisc/lib/checksum.c
> index eaa660491e24..1ae8cc730d13 100644
> --- a/arch/parisc/lib/checksum.c
> +++ b/arch/parisc/lib/checksum.c
> @@ -27,11 +27,8 @@
>  
>  static inline unsigned short from32to16(unsigned int x)
>  {
> -	/* 32 bits --> 16 bits + carry */
> -	x = (x & 0xffff) + (x >> 16);
> -	/* 16 bits + carry --> 16 bits including carry */
> -	x = (x & 0xffff) + (x >> 16);
> -	return (unsigned short)x;
> +	x += ror32(x, 16);
> +	return (unsigned short)(x >> 16);
>  }
>  
>  unsigned int do_csum(const unsigned char *buff, int len)
> 
> -- 
> 2.34.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ