Fixed issue decoding signed ints and shorts

git-svn-id: https://smali.googlecode.com/svn/trunk@167 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com 2009-06-19 00:38:14 +00:00
parent fa07a1972e
commit dc4bcbe0c0

View File

@ -48,7 +48,7 @@ public class NumberUtils {
public static short decodeShort(byte lsb, byte msb) { public static short decodeShort(byte lsb, byte msb) {
return (short) return (short)
( lsb | ( (lsb & 0xFF) |
(msb << 8) (msb << 8)
); );
} }
@ -59,9 +59,9 @@ public class NumberUtils {
} }
public static int decodeInt(byte lsb, byte mlsb, byte mmsb, byte msb) { public static int decodeInt(byte lsb, byte mlsb, byte mmsb, byte msb) {
return lsb | return (lsb & 0xFF) |
(mlsb << 8) | ((mlsb & 0xFF) << 8) |
(mmsb << 16) | ((mmsb & 0xFF) << 16) |
(msb << 24); (msb << 24);
} }