> Added an epicsUInt32 utop variable to calcPerform() to reduce the number of
> casts, and added some code comments.
Looks good, thanks.
> Previous versions have always handled shifts as signed quantities, so the sign
> bit is extended on right-shifts.
Fine with me. I was just seeing the asymmetry.
> The shift operators also need to have their shift count limited to avoid
> Undefined Behavior; I see 2 realistic possibilities: ANDing the shift count
> with 31; or return 0 / -1 on shift-overflow [...]
> I have implemented the first option for now.
Fine with me. We don't have to fix the holes in the definition.
> The large positive decimal values in your tests are causing the same overflows
> when converted from double to integer that Dirk originally reported, they
> always convert to 0x80000000 on my RHEL systems so some tests fail.
Interesting. Is that a compiler or a size dependency? My Debian 64bit gcc5 machine was testing them fine.
> Added an epicsUInt32 utop variable to calcPerform() to reduce the number of
> casts, and added some code comments.
Looks good, thanks.
> Previous versions have always handled shifts as signed quantities, so the sign
> bit is extended on right-shifts.
Fine with me. I was just seeing the asymmetry.
> The shift operators also need to have their shift count limited to avoid
> Undefined Behavior; I see 2 realistic possibilities: ANDing the shift count
> with 31; or return 0 / -1 on shift-overflow [...]
> I have implemented the first option for now.
Fine with me. We don't have to fix the holes in the definition.
> The large positive decimal values in your tests are causing the same overflows
> when converted from double to integer that Dirk originally reported, they
> always convert to 0x80000000 on my RHEL systems so some tests fail.
Interesting. Is that a compiler or a size dependency? My Debian 64bit gcc5 machine was testing them fine.
Thanks a lot!