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] [day] [month] [year] [list]
Message-ID: <20110520140045.GC23076@ericsson.com>
Date:	Fri, 20 May 2011 07:00:45 -0700
From:	Guenter Roeck <guenter.roeck@...csson.com>
To:	Ashish Jangam <Ashish.Jangam@...tcummins.com>
CC:	Randy Dunlap <randy.dunlap@...cle.com>,
	Dajun Chen <Dajun.Chen@...semi.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"lm-sensors@...sensors.org" <lm-sensors@...sensors.org>
Subject: Re: [PATCHv3 6/11] HWMON: Fixed point conversion gives linktime
 error

On Fri, May 20, 2011 at 06:57:18AM -0400, Ashish Jangam wrote:
> Hi,
> 
> As requested approximation of battery temperature calculation with fixed point conversion is tried but it causes couple of link time errors, like undefined reference to __aeabi_i2d at sprintf(). Have a look at the function da9052_read_tbat(); we feel that this function should not be supported else there will be a prerequisite to the support the required floating point library. Enabling FPE_NWFPE support in the kernel gives the same link time errors.
> 
You have defined

#define LOGN2          0.693147181

and use it, which makes the entire calculation a floating point calculation
and defeats the purpose. The idea would have been to define something like 

#define CAL_LOG2(nr)	((int)((ilog2(nr) - ilog2(100)) * 693147181LL / 1000000000LL))

Also, there is no need for rounding, say, 0.003355705 to 0.0034, or 2.5 to 3.
Add a few digits, like above, and remove them afterwards.

	x * 2.5 = x * 5 / 2.
	x * 33.55705 = x * 3355705 / 100000

Just be careful that you don't get overflows.

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