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: <4829A39F.7050308@laptop.org>
Date:	Tue, 13 May 2008 10:20:15 -0400
From:	"Richard A. Smith" <richard@...top.org>
To:	Andres Salomon <dilinger@...ued.net>
CC:	avorontsov@...mvista.com,
	Andrew Morton <akpm@...ux-foundation.org>, cbou@...l.ru,
	linux-kernel@...r.kernel.org, dwmw2@...radead.org
Subject: Re: [PATCH] power_supply: add CHARGE_COUNTER property and olpc_battery
 support for it

Andres Salomon wrote:

> +		ec_word = be16_to_cpu(ec_word);
> +		val->intval = ec_word * 4167 / 10;

Whats wrong with:

 > +		val->intval = ((int)ec_word) * 6250 / 15;

Which does not have overflow problems and keeps more precision.

-- 
Richard Smith  <richard@...top.org>
One Laptop Per Child
--
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