lkml.org 
[lkml]   [2021]   [Dec]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] drivers:iio:dac make expression evaluation 64-bit
On Wed, Dec 22, 2021 at 5:59 PM Muhammad Usama Anjum
<usama.anjum@collabora.com> wrote:
>
> Two 32-bit values are being evaluated using 32-bit arithmetic and then
> passed to s64 type. It is wrong. Expression should be evaluated using
> 64-bit arithmetic and then passed.

...

> dac->ch_data[ch].scale_dec = DIV_ROUND_CLOSEST((s64)rem * 1000000,
> 65536);

Shouldn't the above be fixed as well? Has anybody tried to compile on
32-bit arch this?

> - dac->ch_data[ch].offset_int = div_s64_rem(v_min * 65536, span, &rem);
> + dac->ch_data[ch].offset_int = div_s64_rem(v_min * 65536L, span, &rem);
> tmp = (s64)rem * 1000000;
> dac->ch_data[ch].offset_dec = div_s64(tmp, span);
> }

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2021-12-22 19:52    [W:0.055 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site