aboutsummaryrefslogtreecommitdiffstats
path: root/ddms/libs/ddmlib
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2010-05-04 18:18:37 -0700
committerKenny Root <kroot@google.com>2010-05-05 10:27:18 -0700
commitb6f7188561f88511ed7a8685a0e9f67d5bae8558 (patch)
tree7d02352bba0645375351130396f0b38f886413b4 /ddms/libs/ddmlib
parent711c35d7e18a262cde3800eecec26d52a25d532a (diff)
downloadsdk-b6f7188561f88511ed7a8685a0e9f67d5bae8558.zip
sdk-b6f7188561f88511ed7a8685a0e9f67d5bae8558.tar.gz
sdk-b6f7188561f88511ed7a8685a0e9f67d5bae8558.tar.bz2
Small mask calculation optimization
Get rid of loop to calculate bitmask where 2^n-1 will suffice. Change-Id: I1d77a5c3753207663531efb407f6114ccabb1220
Diffstat (limited to 'ddms/libs/ddmlib')
-rw-r--r--ddms/libs/ddmlib/src/com/android/ddmlib/RawImage.java9
1 files changed, 2 insertions, 7 deletions
diff --git a/ddms/libs/ddmlib/src/com/android/ddmlib/RawImage.java b/ddms/libs/ddmlib/src/com/android/ddmlib/RawImage.java
index 3ec6148..adb0cc9 100644
--- a/ddms/libs/ddmlib/src/com/android/ddmlib/RawImage.java
+++ b/ddms/libs/ddmlib/src/com/android/ddmlib/RawImage.java
@@ -216,12 +216,7 @@ public final class RawImage {
* @param length
* @return
*/
- private int getMask(int length) {
- int res = 0;
- for (int i = 0 ; i < length ; i++) {
- res = (res << 1) + 1;
- }
-
- return res;
+ private static int getMask(int length) {
+ return (1 << length) - 1;
}
}