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:	Wed, 31 Oct 2007 21:25:16 +0100
From:	Richard Knutsson <ricknu-0@...dent.ltu.se>
To:	Lennart Sorensen <lsorense@...lub.uwaterloo.ca>
CC:	Paul Jimenez <pj@...ce.org>, rgooch@...f.csiro.au,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mtrr use type bool

Lennart Sorensen wrote:
> On Wed, Oct 31, 2007 at 04:27:31PM +0100, Richard Knutsson wrote:
>   
>> Paul Jimenez wrote:
>>     
> ....
>   
>>> -			usage_table[i] = usage_table[replace] + !!increment;
>>> +			usage_table[i] = usage_table[replace] + increment;
>>>  
>>>       
>> This seems a bit strange, using a boolean as an integer (yes I know, it 
>> works but semantically...). What about:
>>
>> +			usage_table[i] = usage_table[replace];
>> +			usage_table[i] += increment ? 1 : 0;
>>     
>
> What is wrong with:
> usage_table[i] = usage_table[replace];
> if (increment)
> 	usage_table[i]++;
>
> I hate code with the '?' operator in general.  It's a conditional either
> way, and at least this way you wouldn't even have to do a store in one
> of the two cases 9although if the compiler can't figure out that is the
> case already, then it really sucks).
>   
I kind of like them :)
But you are right, since the 'else' doesn't do anything, an if() is more 
clear.
> Pauls code at least didn't involve a conditional at all, but on the
> other hand is less clear to read.
>   
Mm, I know. But on the upside, many places had/have some sort of a = b ? 
TRUE : FALSE, which are getting cleaned out.

Richard Knutsson

-
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