com.github.unidbg.unix.struct.StdString64 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of unidbg Show documentation
Show all versions of unidbg Show documentation
Allows you to emulate an Android ARM32 and/or ARM64 native library
package com.github.unidbg.unix.struct;
import com.sun.jna.Pointer;
import java.util.Arrays;
import java.util.List;
/**
* Note: Only compatible with libc++, though libstdc++'s std::string is a lot simpler.
*/
public class StdString64 extends StdString {
StdString64(Pointer p) {
super(p);
unpack();
}
public byte isTiny;
public long size;
public Pointer value;
@Override
protected List getFieldOrder() {
return Arrays.asList("isTiny", "size", "value");
}
@Override
public Pointer getDataPointer() {
boolean isTiny = (this.isTiny & 1) == 0;
if (isTiny) {
return getPointer().share(1);
} else {
return value;
}
}
@Override
public long getDataSize() {
boolean isTiny = (this.isTiny & 1) == 0;
if (isTiny) {
return (this.isTiny & 0xff) >> 1;
} else {
return size;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy