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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 5 Dec 2013 15:32:29 -0800
From:	Stephen Hemminger <stephen@...workplumber.org>
To:	Joe Perches <joe@...ches.com>
Cc:	netdev@...r.kernel.org, Rob Landley <rob@...dley.net>,
	linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next] ether_addr_equal: Optimize implementation,
 remove unused compare_ether_addr

On Thu,  5 Dec 2013 14:54:38 -0800
Joe Perches <joe@...ches.com> wrote:

> +#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
> +	u32 fold = ((*(const u32 *)addr1) ^ (*(const u32 *)addr2)) |
> +		   ((*(const u16 *)(addr1 + 4)) ^ (*(const u16 *)(addr2 + 4)));
> +
> +	return fold == 0;

Why the temporary variable. You can just do:
	return ((*(const u32 *)addr1) ^ (*(const u32 *)addr2)) |
	       ((*(const u16 *)(addr1 + 4)) ^ (*(const u16 *)(addr2 + 4))) != 0;

Or
	return !!((*(const u32 *)addr1) ^ (*(const u32 *)addr2)) |
	         ((*(const u16 *)(addr1 + 4)) ^ (*(const u16 *)(addr2 + 4))));
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ