Re: [PATCH v10 03/14] iio: inkern: make a best effort on offset calculation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 20, 2021 at 11:17 AM Liam Beguin <liambeguin@xxxxxxxxx> wrote:
>
> From: Liam Beguin <lvb@xxxxxxxxxx>
>
> iio_convert_raw_to_processed_unlocked() assumes the offset is an
> integer. Make a best effort to get a valid offset value for fractional
> cases without breaking implicit truncations.

...

> +                       offset_val /= (1 << offset_val2);

Besides potentially being problematic (if arg is 31 for the left
shift) why not simply

_val >>= _val2;

?

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux