Merge commit '3621a6c08002c6b3e5b6f91bb0e20d8372613160' into dev
This commit is contained in:
16
external/capstone/utils.c
vendored
16
external/capstone/utils.c
vendored
@@ -146,6 +146,20 @@ uint32_t readBytes32(MCInst *MI, const uint8_t *Bytes)
|
||||
return Insn;
|
||||
}
|
||||
|
||||
/// Reads 3 bytes in the endian order specified in MI->cs->mode.
|
||||
uint32_t readBytes24(MCInst *MI, const uint8_t *Bytes)
|
||||
{
|
||||
assert(MI && Bytes);
|
||||
uint32_t Insn;
|
||||
if (MODE_IS_BIG_ENDIAN(MI->csh->mode))
|
||||
Insn = (Bytes[2]) | (Bytes[1] << 8) |
|
||||
((uint32_t)Bytes[0] << 16);
|
||||
else
|
||||
Insn = (Bytes[2] << 16) | (Bytes[1] << 8) |
|
||||
((uint32_t)Bytes[0]);
|
||||
return Insn;
|
||||
}
|
||||
|
||||
/// Reads 2 bytes in the endian order specified in MI->cs->mode.
|
||||
uint16_t readBytes16(MCInst *MI, const uint8_t *Bytes)
|
||||
{
|
||||
@@ -230,7 +244,7 @@ char *byte_seq_to_str(uint8_t *bytes, size_t len)
|
||||
char *s = calloc(sizeof(char), 32);
|
||||
for (size_t i = 0; i < len; ++i) {
|
||||
cs_snprintf(single_byte, sizeof(single_byte), "0x%02" PRIx8 "%s",
|
||||
bytes[i], i == len - 1 ? "" : ",");
|
||||
bytes[i], i == len - 1 ? "" : ", ");
|
||||
s = str_append(s, single_byte);
|
||||
if (!s) {
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user