mirror of
https://github.com/revanced/ARSCLib.git
synced 2025-04-30 06:14:25 +02:00
implement unsigned byte & short value
This commit is contained in:
parent
f81616f2f1
commit
e873913f68
@ -73,6 +73,13 @@ public class ByteArray extends BlockItem {
|
|||||||
}
|
}
|
||||||
return getBytesInternal()[index];
|
return getBytesInternal()[index];
|
||||||
}
|
}
|
||||||
|
public int getByteUnsigned(int index){
|
||||||
|
Byte b = get(index);
|
||||||
|
if(b==null){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 0xff & b;
|
||||||
|
}
|
||||||
public final void put(int index, byte value){
|
public final void put(int index, byte value){
|
||||||
byte[] bts = getBytesInternal();
|
byte[] bts = getBytesInternal();
|
||||||
bts[index]=value;
|
bts[index]=value;
|
||||||
@ -99,6 +106,9 @@ public class ByteArray extends BlockItem {
|
|||||||
bts[offset+1]= (byte) (val >>> 8 & 0xff);
|
bts[offset+1]= (byte) (val >>> 8 & 0xff);
|
||||||
bts[offset]= (byte) (val & 0xff);
|
bts[offset]= (byte) (val & 0xff);
|
||||||
}
|
}
|
||||||
|
public final int getShortUnsigned(int offset){
|
||||||
|
return 0xffff & getShort(offset);
|
||||||
|
}
|
||||||
public final short getShort(int offset){
|
public final short getShort(int offset){
|
||||||
byte[] bts = getBytesInternal();
|
byte[] bts = getBytesInternal();
|
||||||
return (short) (bts[offset] & 0xff | (bts[offset+1] & 0xff) << 8);
|
return (short) (bts[offset] & 0xff | (bts[offset+1] & 0xff) << 8);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user