On Thu, Aug 29, 2019 at 08:14:54AM +0200, Fabien COELHO wrote:
> Attached v7 does create uint64 overflow inline functions. The stuff yet is
> not moved to "common/int.c", a file which does not exists, even if
> "common/int.h" does.
Thanks for the new version. I have begun reviewing your patch, and
attached is a first cut that I would like to commit separately which
adds all the compatibility overflow routines to int.h for uint16,
uint32 and uint64 with all the fallback implementations (int128-based
method added as well if available). I have also grouped at the top of
the file the comments about each routine's return policy to avoid
duplication. For the fallback implementations of uint64 using int128,
I think that it is cleaner to use uint128 so as there is no need to
check after negative results for multiplications, and I have made the
various expressions consistent for each size.
Attached is a small module called "overflow" with various regression
tests that I used to check each implementation. I don't propose that
for commit as I am not sure if that's worth the extra CPU, so let's
consider it as a toy for now.
What do you think?
--
Michael