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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 1 May 2015 20:14:23 -0400 (EDT)
From:	Nicolas Pitre <nicolas.pitre@...aro.org>
To:	John Stultz <john.stultz@...aro.org>
cc:	linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
	Josh Boyer <jwboyer@...hat.com>,
	One Thousand Gnomes <gnomes@...rguk.ukuu.org.uk>
Subject: Re: [PATCH] ktime: Fix ktime_divns to do signed division

On Fri, 1 May 2015, John Stultz wrote:

>  static inline u64 ktime_divns(const ktime_t kt, s64 div)
>  {
>  	if (__builtin_constant_p(div) && !(div >> 32)) {
> -		u64 ns = kt.tv64;
> +		s64 ns = kt.tv64;
> +		int neg = 0;
> +
> +		if (ns < 0) {
> +			neg = 1;
> +			ns = -ns;
> +		}

Minor comment: you could save some realestate with:

		s64 ns = kt.tv64;
		bool neg = (ns < 0);

		if (neg)
			ns = -ns;


Nicolas
--
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