summaryrefslogtreecommitdiffstats
path: root/dex
diff options
context:
space:
mode:
authorBrian Carlstrom <bdc@google.com>2013-04-29 17:03:03 -0700
committerBrian Carlstrom <bdc@google.com>2013-04-30 14:50:12 -0700
commit450a197f09d35a07be12a924d4db1ecd2bee65fe (patch)
treea7820a5ed69e4b2b9f18d82b7c46b84511880596 /dex
parent1f203dc168cd4ab457d9690bc78766fe63da2cf9 (diff)
downloadlibcore-450a197f09d35a07be12a924d4db1ecd2bee65fe.zip
libcore-450a197f09d35a07be12a924d4db1ecd2bee65fe.tar.gz
libcore-450a197f09d35a07be12a924d4db1ecd2bee65fe.tar.bz2
Remove redundant alignToFourBytes in favor of alignToFourBytesWithZeroFill
(cherry picked from commit d2301a66b2629f2841ab3a3cc7684a645ebe7217) Change-Id: I32522d86950d0c1a89e77b44ddeab071ce9c021a
Diffstat (limited to 'dex')
-rw-r--r--dex/src/main/java/com/android/dex/Dex.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/dex/src/main/java/com/android/dex/Dex.java b/dex/src/main/java/com/android/dex/Dex.java
index 3fa5ab5..9ecd133 100644
--- a/dex/src/main/java/com/android/dex/Dex.java
+++ b/dex/src/main/java/com/android/dex/Dex.java
@@ -268,10 +268,6 @@ public final class Dex {
return nextSectionStart;
}
- private static int fourByteAlign(int position) {
- return (position + 3) & ~3;
- }
-
/**
* Returns a copy of the the bytes of this dex.
*/
@@ -633,9 +629,16 @@ public final class Dex {
}
/**
- * Writes 0x00 until the position is aligned to a multiple of 4.
+ * Skips bytes until the position is aligned to a multiple of 4.
*/
public void alignToFourBytes() {
+ data.position((data.position() + 3) & ~3);
+ }
+
+ /**
+ * Writes 0x00 until the position is aligned to a multiple of 4.
+ */
+ public void alignToFourBytesWithZeroFill() {
while ((data.position() & 3) != 0) {
data.put((byte) 0);
}
@@ -710,7 +713,7 @@ public final class Dex {
for (short type : types) {
writeShort(type);
}
- alignToFourBytes();
+ alignToFourBytesWithZeroFill();
}
/**