bearophile wrote:
1. Yes it is meaningful - depending on what you're doing.
I am not sure.
2. Such a runtime test is expensive in terms of performance and code bloat.
I have not seen even synthetic benchmarks about this.
Look at the asm dump of a function. It's full of add's - not only ADD
instructions, but addressing mode multiplies and add's. Subtraction is often
expressed in terms of addition, relying on twos-complement wraparound.
Trying to remove twos-complement arithmetic from a systems language is like
trying to teach your cat to fetch.