Hi Csaba,

Yes, thanks. nasal demons, indeed. I forgot that the signed integer overflow causes undefined behavior unlike unsigned integer overflow, which causes wrap around.

The code
    return (long)(0ul - (unsigned long)x) > 0;
does what I want.

I am impressed by clang's ability to use this undefinedness to enable optimizations like (-x) > 0 to x < 0, which seems to be valid for all valid arguments.

Best regards,
Artem

On 23-2-2015 9:44, Csaba Raduly wrote:
cast to an unsigned type to negate
this value to itself



<<attachment: artem_alimarin.vcf>>

_______________________________________________
cfe-users mailing list
cfe-users@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users

Reply via email to