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, 20 Aug 2008 11:15:55 -0700
From:	"Ray Lee" <ray-lk@...rabbit.org>
To:	"Nick Piggin" <nickpiggin@...oo.com.au>
Cc:	"Peter Zijlstra" <a.p.zijlstra@...llo.nl>, adobriyan@...il.com,
	"Ingo Molnar" <mingo@...e.hu>,
	"Zhang, Yanmin" <yanmin_zhang@...ux.intel.com>,
	"Dhaval Giani" <dhaval@...ux.vnet.ibm.com>,
	LKML <linux-kernel@...r.kernel.org>,
	"Srivatsa Vaddagiri" <vatsa@...ux.vnet.ibm.com>,
	"Aneesh Kumar KV" <aneesh.kumar@...ux.vnet.ibm.com>,
	"Balbir Singh" <balbir@...ibm.com>,
	"Chris Friesen" <cfriesen@...tel.com>
Subject: Re: VolanoMark regression with 2.6.27-rc1

On Wed, Aug 20, 2008 at 10:55 AM, Nick Piggin <nickpiggin@...oo.com.au> wrote:
> On Thursday 21 August 2008 03:21, Peter Zijlstra wrote:
>> Ok, so one last time (I hope!)..
>>
>> Everybody happy with this?
>
>
>> Index: linux-2.6/include/linux/kernel.h
>> ===================================================================
>> --- linux-2.6.orig/include/linux/kernel.h
>> +++ linux-2.6/include/linux/kernel.h
>> @@ -367,6 +367,12 @@ static inline char *pack_hex_byte(char *
>>       (void) (&_max1 == &_max2);              \
>>       _max1 > _max2 ? _max1 : _max2; })
>>
>> +#define avg(x, y) ({                         \
>> +     typeof(x) _avg1 = (x);                  \
>> +     typeof(y) _avg2 = (y);                  \
>> +     (void) (&_avg1 == &_avg2);              \
>> +     _avg1 + (_avg2 - _avg1)/2; })
>
> That's not going to work with unsigned types.

Uhm, I think it works fine, even with unsigned, even where _avg2 is
smaller than _avg1. Underflow is a good thing here. And I mocked up a
little test harness and it gives the correct answers for a half dozen
sets of values I tossed at it

But maybe I'm forgetting an obscure unsigned or signed int type
widening rule, so, care to elaborate?
--
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