am 396b83b0: Merge "Fix overflow/underflow problem in comparison"

* commit '396b83b0c8a9c615ca416fa7a7d366a4e30971a1':
  Fix overflow/underflow problem in comparison
This commit is contained in:
Chris Tate
2015-06-12 20:07:47 +00:00
committed by Android Git Automerger

View File

@@ -369,10 +369,10 @@ class AlarmManagerService extends SystemService {
public int compare(Batch b1, Batch b2) {
long when1 = b1.start;
long when2 = b2.start;
if (when1 - when2 > 0) {
if (when1 > when2) {
return 1;
}
if (when1 - when2 < 0) {
if (when1 < when2) {
return -1;
}
return 0;
@@ -1482,10 +1482,10 @@ class AlarmManagerService extends SystemService {
public int compare(Alarm a1, Alarm a2) {
long when1 = a1.whenElapsed;
long when2 = a2.whenElapsed;
if (when1 - when2 > 0) {
if (when1 > when2) {
return 1;
}
if (when1 - when2 < 0) {
if (when1 < when2) {
return -1;
}
return 0;