[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180721172924.53619e6a@archlinux>
Date: Sat, 21 Jul 2018 17:29:24 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Himanshu Jha <himanshujha199640@...il.com>
Cc: Andy Shevchenko <andy.shevchenko@...il.com>,
Hartmut Knaack <knaack.h@....de>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Meerwald <pmeerw@...erw.net>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-iio <linux-iio@...r.kernel.org>,
Daniel Baluta <daniel.baluta@...il.com>
Subject: Re: [PATCH v4] iio: chemical: Add support for Bosch BME680 sensor
On Sat, 21 Jul 2018 21:22:30 +0530
Himanshu Jha <himanshujha199640@...il.com> wrote:
> On Sat, Jul 21, 2018 at 06:43:51PM +0300, Andy Shevchenko wrote:
> > On Sat, Jul 21, 2018 at 6:36 PM, Himanshu Jha
> > <himanshujha199640@...il.com> wrote:
> >
> > >> > + /* Look up table 1 for the possible gas range values */
> > >> > + u32 lookupTable1[16] = {2147483647u, 2147483647u, 2147483647u,
> > >> > + 2147483647u, 2147483647u, 2126008810u,
> > >> > + 2147483647u, 2130303777u, 2147483647u,
> > >> > + 2147483647u, 2143188679u, 2136746228u,
> > >> > + 2147483647u, 2126008810u, 2147483647u,
> > >> > + 2147483647u};
> >
> > This one needs perhaps a bit of though, but...
> >
> > >> > + /* Look up table 2 for the possible gas range values */
> > >> > + u32 lookupTable2[16] = {4096000000u, 2048000000u, 1024000000u,
> > >> > + 512000000u, 255744255u, 127110228u, 64000000u,
> > >> > + 32258064u, 16016016u, 8000000u, 4000000u,
> > >> > + 2000000u, 1000000u, 500000u, 250000u, 125000u};
> >
> > ...this one obviously just a not needed one. You may replace it with a
> > one constant and simple calculation to get either value (index from
> > value, or value from index).
>
> Not sure to understand your opinion!?
>
> Anything related to increase to .ro segment ?
>
> I think adding is better to let compiler optimise the code a bit
> further.
No, I missed this as didn't look too closely at those numbers.
They are almost by not quite simple power's of 2 * 125000.
Question is whether the very very small difference from that matter or not...
Andy is suggesting replacing this block of data with an equation that is
'near enough'.
>
> > --
> > With Best Regards,
> > Andy Shevchenko
>
Powered by blists - more mailing lists