Allow try end addresses that fall in the middle of an instruction

This commit is contained in:
Ben Gruver
2012-08-24 14:52:55 -07:00
parent 7d37656282
commit 5934004fe3
2 changed files with 44 additions and 31 deletions

View File

@ -70,6 +70,24 @@ public class SparseIntArray {
}
}
/**
* Gets the int mapped from the specified key, or if not present, the
* closest key that is less than the specified key.
*/
public int getClosestSmaller(int key) {
int i = binarySearch(mKeys, 0, mSize, key);
if (i < 0) {
i = ~i;
if (i > 0) {
i--;
}
return mValues[i];
} else {
return mValues[i];
}
}
/**
* Removes the mapping from the specified key, if there was any.
*/