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: <AE90C24D6B3A694183C094C60CF0A2F6026B701A@saturn3.aculab.com>
Date:	Wed, 3 Oct 2012 09:20:02 +0100
From:	"David Laight" <David.Laight@...LAB.COM>
To:	"Stephen Hemminger" <shemminger@...tta.com>,
	"Julian Anastasov" <ja@....bg>
Cc:	"Eric Dumazet" <eric.dumazet@...il.com>, <netdev@...r.kernel.org>
Subject: RE: [PATCH v2] iproute2: add support for tcp_metrics

> > 	fprintf(fp, "%lluus",
> > 		((__u64) val * 1000) >> 2);
...
> Remember u64 is not always same as unsigned long long.
> One safe way of handling this is:
...
> 	fprintf(fp, "%"PRIu64"us",
>  		((__u64) val * 1000) >> 3);

Or convert the constant.
	fprintf(fp, "%lluus", (val * 1000ull) >> 2);
which may well generate better code on 32bit systems.

	David


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ