On Sat, Jun 21, 2025 at 10:24 PM Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote: > On Sat, Jun 21, 2025 at 9:54 PM Lothar Rubusch <l.rubusch@xxxxxxxxx> wrote: > > On Thu, Jun 12, 2025 at 2:15 PM Andy Shevchenko > > <andriy.shevchenko@xxxxxxxxx> wrote: > > > On Tue, Jun 10, 2025 at 09:59:30PM +0000, Lothar Rubusch wrote: ... > > > > + val = (adxl345_odr_tbl[odr][0] > max_boundary) > > > > + ? min_boundary : max_boundary - adxl345_odr_tbl[odr][0]; > > > > > > clamp() ? > > > > Isn't clamp() dealing with signed ints? > > clamp() is a macro. > > > Also, I'll take the diff from > > max_boundary here. > > How does it affect usage of the clamp()? I see what you mean, but this can be done by clamping the signed values. So, in any case try to improve this and add a comment explaining why the maximum boundary is adjusted. > > So, I'll try staying with the current line and hope > > it's fine. > > I suggest you spend some time thinking about this expression on how to > make it easier to read and understand. In my opinion clamp() helps a > lot in this case. -- With Best Regards, Andy Shevchenko