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: <20160608093947.GQ30154@twins.programming.kicks-ass.net>
Date:	Wed, 8 Jun 2016 11:39:47 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	"H. Peter Anvin" <hpa@...or.com>
Cc:	Ingo Molnar <mingo@...nel.org>,
	"H. Peter Anvin" <hpa@...ux.intel.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Andy Lutomirski <luto@...capital.net>,
	Borislav Petkov <bp@...en8.de>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly
 outputs

On Wed, Jun 08, 2016 at 02:31:31AM -0700, H. Peter Anvin wrote:
> On 06/08/16 02:20, Ingo Molnar wrote:
> > 
> > Yeah, absolutely. I hate 'bool' with a vengence but if 'int' generates worse code 
> > with modern compilers then I'm not going to argue for worse code. Would a 'char' 
> > return type be very weird?
> > 
> 
> Yes.  I have to admit I don't share your hatred for "bool" -- it gives
> the compiler a fairly crucial bit of information about what the possible
> values are for a certain piece of data.
> 
> Upcasting to char loses that, and may case gcc to manifest the value as
> an integer instead of retaining it in the flags.  It is, however, less
> likely to cause gcc to then try to widen the value to word size (which
> is an extra instruction on x86), but moving the value out of and back
> into the flags register is the big cost.

So I think using bool as return type or argument is fine, using it in
structures is 'insane'.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ