Re: [PATCH v1 2/6] units: Add value of π * 10⁹

Andy Shevchenko
2025-10-28T08:09:16Z

On Mon, Oct 27, 2025 at 09:59:10AM -0500, David Lechner wrote:
> On 10/27/25 9:52 AM, Jonathan Cameron wrote:
> > On Mon, 27 Oct 2025 15:34:51 +0100
> > Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> >
> >> There are a few drivers that want to have this value, and at least one
> >> known to come soon. Let's define a value for them.
> >
> > Is there any way we can make the x10^9 bit obvious in the naming? Or do
> > something a bit nasty like defining a macro along the lines of
> >
> > PI(scale)?
> > e.g. PI(NANO), PI(10000)
> >
> This was my first thought when looking at this as well.
>
> Or something like PI_x10(6).

We need a good macro that may _at compile-time_ convert 64-bit input to 32-bit
value that may be suitable for 32-bit arithmetics / architectures.

--
With Best Regards,
Andy Shevchenko