use unsigned shift while writing an unsigned leb128

git-svn-id: https://smali.googlecode.com/svn/trunk@416 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com 2009-08-25 01:16:26 +00:00
parent 2773319471
commit e9c67dbb9c
2 changed files with 4 additions and 4 deletions

View File

@ -223,13 +223,13 @@ public final class ByteArrayOutput implements Output
/** {@inheritDoc} */ /** {@inheritDoc} */
public int writeUnsignedLeb128(int value) { public int writeUnsignedLeb128(int value) {
int remaining = value >> 7; int remaining = value >>> 7;
int count = 0; int count = 0;
while (remaining != 0) { while (remaining != 0) {
writeByte((value & 0x7f) | 0x80); writeByte((value & 0x7f) | 0x80);
value = remaining; value = remaining;
remaining >>= 7; remaining >>>= 7;
count++; count++;
} }

View File

@ -37,12 +37,12 @@ public final class Leb128Utils {
public static int unsignedLeb128Size(int value) { public static int unsignedLeb128Size(int value) {
// TODO: This could be much cleverer. // TODO: This could be much cleverer.
int remaining = value >> 7; int remaining = value >>> 7;
int count = 0; int count = 0;
while (remaining != 0) { while (remaining != 0) {
value = remaining; value = remaining;
remaining >>= 7; remaining >>>= 7;
count++; count++;
} }