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: <fc8a60d5-a876-4fe5-836f-cd778617003e@email.android.com>
Date:	Sat, 28 Sep 2013 12:42:37 -0700
From:	"H. Peter Anvin" <hpa@...or.com>
To:	Ingo Molnar <mingo@...nel.org>, Borislav Petkov <bp@...en8.de>
CC:	linux-kernel@...r.kernel.org, huawei.libin@...wei.com,
	wangyijing@...wei.com, fenghua.yu@...el.com, tglx@...utronix.de,
	guohanjun@...wei.com, paul.gortmaker@...driver.com,
	linux-tip-commits@...r.kernel.org
Subject: Re: [PATCH -v1.1] x86, boot: Further compress CPUs bootup message

How about:

m = 10;
d = 1;

while ( val >= m ) {
        m *= 10;
        d++;
}

... and not have a *divide* in there?

Man, entering code on a cell phone sucks...
        

Ingo Molnar <mingo@...nel.org> wrote:
>
>* Borislav Petkov <bp@...en8.de> wrote:
>
>> @@ -2,6 +2,10 @@ int num_digits(int val)
>>  {
>>  	int digits = 0;
>>  
>> +	/* Handle special case */
>> +	if (!val)
>> +		return 1;
>> +
>>  	while (val) {
>>  		val /= 10;
>>  		digits++;
>
>Hm. I suspect this could then be written as:
>
>int num_digits(int val)
>{
>	int digits = 0;
>
>	do {
>		val /= 10;
>		digits++;
>	} while (val);
>
>	return digits;
>}
>
>No ugly special case! :-)
>
>Thanks,
>
>	Ingo

-- 
Sent from my mobile phone.  Please pardon brevity and lack of formatting.
--
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