D-Programming-Language/dmd — pull request #1889 by lionello (2013-04-12 02:22:39+00:00)
Title: For integer comparisons, ensure the signed-unsigned comparison is safe.

1. If the sizeof(signed type) > sizeof(unsigned type), cast to unsigned to signed
2. If min(signed value) >= 0, cast signed to unsigned
3. If max(unsigned value) < max(unsigned type)/2, cast unsigned to signed-of-same-size
else the comparison is in error.