Rewrite arithmetic conversions from scratch

We follow the text of the standard closely (6.3.1.8) instead of trying
to outsmart it. This fixes in particular conversion for unsigned long
and signed long long when sizeof(long) == sizeof(long long).