This generally looks OK to me (including the tests).

+  HOST_WIDE_INT max = ((uint64_t)1 << bitsize) - 1;

Wouldn't a uint64_t type for max be clearer? I guess the worst that can happen is compiling on a 32-bit host for a 64-bit target and get bitsize == 32 here.
Do we even support this?  If so it's surely not well tested :)

Then we'd save a negative constant in mul_max but perform an unsigned compare so we should still be safe.

Nothing that warrants a revision, so IMHO OK with or without the change.

--
Regards
Robin

Reply via email to