SOURCES: iproute2-rates-1024-fix.patch - updated

Jakub Bogusz qboosh w pld-linux.org
Pon, 26 Lip 2004, 01:09:31 CEST


On Sun, Jul 25, 2004 at 06:22:50PM +0000, paszczus wrote:

> + 	else if (strcasecmp(p, "kibit") == 0)
> +-		bps *= 1024 / 8;
> ++		bps *= 1000 / 8;
> + 	else if (strcasecmp(p, "mibit") == 0)
> +-		bps *= 1024*1024/8;
> ++		bps *= 1000*1000/8;
> + 	else if (strcasecmp(p, "gibit") == 0)
> + 		bps *= 1024*1024*1024/8;

> +-		if (tmp >= 1024*1023 && 
> +-		    fabs(1024*1024*rint(tmp/(1024*1024)) - tmp) < 1024)
> +-			snprintf(buf, len, "%gMibps", rint(tmp/(1024*1024)));
> +-		else if (tmp >= 1024-16 && fabs(1024*rint(tmp/1024) - tmp) < 16)
> +-			snprintf(buf, len, "%gKibps", rint(tmp/1024));
> ++		if (tmp >= 1000*999 && 
> ++		    fabs(1000*1000*rint(tmp/(1000*1000)) - tmp) < 1000)
> ++			snprintf(buf, len, "%gMibps", rint(tmp/(1000*1000)));
> ++		else if (tmp >= 1000-10 && fabs(1024*rint(tmp/1000) - tmp) < 10)
> ++			snprintf(buf, len, "%gKibps", rint(tmp/1000));

No bez takich, ki/mi/gi to potęgi 1024.


-- 
Jakub Bogusz    http://cyber.cs.net.pl/~qboosh/




Więcej informacji o liście dyskusyjnej pld-devel-pl