Issue 259: ensure the signed-unsigned comparison is safe

1. If the sizeof(signed type) > sizeof(unsigned type), cast unsigned to signed
2. If the sizeof(common type) > sizeof(both types), cast both to common signed
3. If min(signed value) >= 0, cast signed to unsigned
else the comparison is in error.