Don't use substraction to compare signed integral types, use comparisons

git-svn-id: https://smali.googlecode.com/svn/trunk@427 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com 2009-08-28 07:30:42 +00:00
parent e1b2408a8c
commit 2ec8d992d0
5 changed files with 5 additions and 5 deletions

View File

@ -71,7 +71,7 @@ public class ByteEncodedValue extends EncodedValue {
protected int compareValue(EncodedValue o) { protected int compareValue(EncodedValue o) {
ByteEncodedValue other = (ByteEncodedValue)o; ByteEncodedValue other = (ByteEncodedValue)o;
return value - other.value; return (value<other.value?-1:(value>other.value?1:0));
} }
/** {@inheritDoc} */ /** {@inheritDoc} */

View File

@ -78,7 +78,7 @@ public class CharEncodedValue extends EncodedValue {
protected int compareValue(EncodedValue o) { protected int compareValue(EncodedValue o) {
CharEncodedValue other = (CharEncodedValue)o; CharEncodedValue other = (CharEncodedValue)o;
return value - other.value; return (value<other.value?-1:(value>other.value?1:0));
} }
/** {@inheritDoc} */ /** {@inheritDoc} */

View File

@ -76,7 +76,7 @@ public class IntEncodedValue extends EncodedValue {
protected int compareValue(EncodedValue o) { protected int compareValue(EncodedValue o) {
IntEncodedValue other = (IntEncodedValue)o; IntEncodedValue other = (IntEncodedValue)o;
return value - other.value; return (value<other.value?-1:(value>other.value?1:0));
} }
/** {@inheritDoc} */ /** {@inheritDoc} */

View File

@ -76,7 +76,7 @@ public class LongEncodedValue extends EncodedValue {
protected int compareValue(EncodedValue o) { protected int compareValue(EncodedValue o) {
LongEncodedValue other = (LongEncodedValue)o; LongEncodedValue other = (LongEncodedValue)o;
return Long.signum(value - other.value); return (value<other.value?-1:(value>other.value?1:0));
} }
/** {@inheritDoc} */ /** {@inheritDoc} */

View File

@ -76,7 +76,7 @@ public class ShortEncodedValue extends EncodedValue {
protected int compareValue(EncodedValue o) { protected int compareValue(EncodedValue o) {
ShortEncodedValue other = (ShortEncodedValue)o; ShortEncodedValue other = (ShortEncodedValue)o;
return value - other.value; return (value<other.value?-1:(value>other.value?1:0));
} }
/** {@inheritDoc} */ /** {@inheritDoc} */