diff options
author | Christian Williams <christianw@google.com> | 2017-11-07 17:07:54 -0800 |
---|---|---|
committer | Christian Williams <christianw@google.com> | 2017-11-07 17:08:00 -0800 |
commit | 37af328381ebe31fe11004166e715a96dd74b3d6 (patch) | |
tree | d8345b80667a3f8ab2e3eb90afd954774fddbe8d | |
parent | c80e6a6e822ba6ea33f95fdc2fc068a2d9d74451 (diff) | |
download | robolectric-shadows-37af328381ebe31fe11004166e715a96dd74b3d6.tar.gz |
Fix operator precedence issues in ResTable_config.
-rw-r--r-- | resources/src/main/java/org/robolectric/res/android/ResTable_config.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/resources/src/main/java/org/robolectric/res/android/ResTable_config.java b/resources/src/main/java/org/robolectric/res/android/ResTable_config.java index d949cee7a..f0915ff5e 100644 --- a/resources/src/main/java/org/robolectric/res/android/ResTable_config.java +++ b/resources/src/main/java/org/robolectric/res/android/ResTable_config.java @@ -575,7 +575,7 @@ public class ResTable_config { }; */ private int screenConfig2() { - return (screenLayout2 & 0xff << 24) | (screenConfigPad1 * 0xff << 16) | screenConfigPad2 & 0xffff; + return ((screenLayout2 & 0xff) << 24) | ((screenConfigPad1 * 0xff) << 16) | (screenConfigPad2 & 0xffff); } // If false and localeScript is set, it means that the script of the locale @@ -1520,7 +1520,7 @@ public class ResTable_config { }; */ private int imsi() { - return (mcc & 0xffff) << 16 | (mnc & 0xffff); + return ((mcc & 0xffff) << 16) | (mnc & 0xffff); } /** @@ -1533,7 +1533,7 @@ public class ResTable_config { }; */ private int screenSize() { - return (screenWidth & 0xffff) << 16 | (screenHeight & 0xffff); + return ((screenWidth & 0xffff) << 16) | (screenHeight & 0xffff); } @@ -1548,7 +1548,7 @@ public class ResTable_config { }; */ private int screenConfig() { - return (screenLayout & 0xff << 24) | (uiMode * 0xff << 16) | smallestScreenWidthDp & 0xffff; + return ((screenLayout & 0xff) << 24) | ((uiMode * 0xff) << 16) | (smallestScreenWidthDp & 0xffff); } @@ -1577,7 +1577,7 @@ public class ResTable_config { }; */ private int screenType() { - return (orientation & 0xff << 24) | (touchscreen * 0xff << 16) | density & 0xffff; + return ((orientation & 0xff) << 24) | ((touchscreen & 0xff) << 16) | (density & 0xffff); } /** @@ -1594,7 +1594,7 @@ public class ResTable_config { */ private int input() { // TODO is Pad Zeros? - return (keyboard & 0xff << 24) | (navigation & 0xff << 16) | (inputFlags & 0xff << 8); + return ((keyboard & 0xff) << 24) | ((navigation & 0xff) << 16) | ((inputFlags & 0xff) << 8); } /** @@ -1609,7 +1609,7 @@ public class ResTable_config { }; */ private int version() { - return (sdkVersion & 0xffff) << 16 | (minorVersion & 0xffff); + return ((sdkVersion & 0xffff) << 16) | (minorVersion & 0xffff); } /** @@ -1657,7 +1657,7 @@ public class ResTable_config { }; */ int locale() { - return (language[0] & 0xff << 24) | (language[1] * 0xff << 16) | (country[0] & 0xffff << 8) | (country[1] & 0xffff); + return (language[0] & 0xff << 24) | (language[1] * 0xff << 16) | ((country[0] & 0xff) << 8) | (country[1] & 0xff); } private boolean isLocaleBetterThan( |