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]
Message-ID: <AE90C24D6B3A694183C094C60CF0A2F6026B6E65@saturn3.aculab.com>
Date:	Fri, 10 Feb 2012 09:32:39 -0000
From:	"David Laight" <David.Laight@...LAB.COM>
To:	"Joe Perches" <joe@...ches.com>,
	"David Miller" <davem@...emloft.net>
Cc:	<jeffrey.t.kirsher@...el.com>, <netdev@...r.kernel.org>,
	"linux-wireless" <linux-wireless@...r.kernel.org>
Subject: RE: [PATCH net-next] drivers/net: Remove boolean comparisons to true/false

 
> -	u32 func_encode = func |
> -			((is_Pf == true ? 1 : 0) <<
IGU_FID_ENCODE_IS_PF_SHIFT);
> +	u32 func_encode = func | (is_Pf ? 1 : 0) <<
IGU_FID_ENCODE_IS_PF_SHIFT;

This sort of thing is why I personally don't like 'bool' at all.
If 'is_Pf' were an integer type that is known to only contain 0 or 1
then the code can just be:
	u32 func_encode = func | is_Pf << IGU_FID_ENCODE_IS_PF_SHIFT;
although that is still valid when is_Pf is bool, the compiler
is required to generate code on every access that converts
all non-zero values to 1 - so the generated code is likely
to be 'is_Pf ? 1 : 0'.

The generated code is particularly horrid for boolean arithmetic.
IIRC:
   bool_var &= bool_var_1;
typically requires a sequence of compare and branch instructions.

	David


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ