Fixed an issue with the handling of large line numbers (larger than a signed short)

git-svn-id: https://smali.googlecode.com/svn/trunk@231 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com
2009-07-03 02:13:54 +00:00
parent c6573dfb98
commit aaf4c4062a
4 changed files with 12 additions and 10 deletions

View File

@ -228,17 +228,18 @@ public final class ByteArrayAnnotatedOutput
/** {@inheritDoc} */
public int writeUnsignedLeb128(int value) {
int remaining = value >> 7;
long remaining = (value & 0xFFFFFFFFL) >> 7;
long lValue = value;
int count = 0;
while (remaining != 0) {
writeByte((value & 0x7f) | 0x80);
value = remaining;
writeByte((int)(lValue & 0x7f) | 0x80);
lValue = remaining;
remaining >>= 7;
count++;
}
writeByte(value & 0x7f);
writeByte((int)(lValue & 0x7f));
return count + 1;
}

View File

@ -221,6 +221,7 @@ public class DebugInfoBuilder
addressDelta = 0;
}
//TODO: need to handle the case when the line delta is larger than a signed int
debugInstructions.add(new SpecialOpcode(calculateSpecialOpcode(lineDelta, addressDelta)));

View File

@ -36,13 +36,13 @@ public final class Leb128Utils {
*/
public static int unsignedLeb128Size(int value) {
// TODO: This could be much cleverer.
long lValue = value & 0xFFFFFFFFL;
int remaining = value >> 7;
long remaining = lValue >> 7L;
int count = 0;
while (remaining != 0) {
value = remaining;
remaining >>= 7;
while (remaining != 0L) {
remaining >>= 7L;
count++;
}