diff --git a/src/emucore/elf/ElfUtil.cxx b/src/emucore/elf/ElfUtil.cxx index 233dbf32c..c786b0c00 100644 --- a/src/emucore/elf/ElfUtil.cxx +++ b/src/emucore/elf/ElfUtil.cxx @@ -38,21 +38,21 @@ Int32 elfUtil::decode_B_BL(uInt32 opcode) return offset; } - uInt32 elfUtil::encode_B_BL(Int32 offset, bool link) - { - // nomenclature follows Thumb32 BL / B.W encoding in Arm Architecture Reference +uInt32 elfUtil::encode_B_BL(Int32 offset, bool link) +{ + // nomenclature follows Thumb32 BL / B.W encoding in Arm Architecture Reference - offset >>= 1; + offset >>= 1; - uInt8 s = (offset >> 23) & 0x01; - uInt8 j2 = ((~offset >> 22) ^ s) & 0x01; - uInt8 j1 = ((~offset >> 21) ^ s) & 0x01; - uInt32 imm11 = offset & 0x7ff; - uInt32 imm10 = (offset >> 11) & 0x3ff; + uInt8 s = (offset >> 23) & 0x01; + uInt8 j2 = ((~offset >> 22) ^ s) & 0x01; + uInt8 j1 = ((~offset >> 21) ^ s) & 0x01; + uInt32 imm11 = offset & 0x7ff; + uInt32 imm10 = (offset >> 11) & 0x3ff; - uInt16 hw1 = 0xf000 | (s << 10) | imm10; - uInt16 hw2 = 0x9000 | (j1 << 13) | (j2 << 11) | imm11; - if (link) hw2 |= 0x4000; + uInt16 hw1 = 0xf000 | (s << 10) | imm10; + uInt16 hw2 = 0x9000 | (j1 << 13) | (j2 << 11) | imm11; + if (link) hw2 |= 0x4000; - return hw1 | (hw2 << 16); - } + return hw1 | (hw2 << 16); +}