commit 52113d9fbf936b6242afbe7897a8918a747810b2 (fix battery divisions)
actually broke the battery divisions by using int divisions, causing
the following calculations to overflow:
(100 * BATcapacity_remain) / BATcapacity_full
My battery status showed "-19%".
Values read from sysfs:
BATcapacity_remain = 35140000
BATcapacity_full = 39240000
100 * 35140000 overflows the 31 bits of a signed int so the
calculation results in -780967296 / 39240000 = -19.
Force these calculatoins to be long long to avoid the overflow.
The BATtime_remain calculation just barely does not overflow for me but
fix this as well.
commit 52113d9fbf936b6242afbe7897a8918a747810b2 (fix battery divisions) actually broke the battery divisions by using int divisions, causing the following calculations to overflow: (100 * BATcapacity_remain) / BATcapacity_full
My battery status showed "-19%". Values read from sysfs: BATcapacity_remain = 35140000 BATcapacity_full = 39240000
100 * 35140000 overflows the 31 bits of a signed int so the calculation results in -780967296 / 39240000 = -19.
Force these calculatoins to be long long to avoid the overflow. The BATtime_remain calculation just barely does not overflow for me but fix this as well.