<commit_before>#include "instr.h"

#define MIPS_JTYPE_EXTRACT_TARGET(Instr) (Instr & ((1 << 26) - 1))

namespace sasm { namespace instr { namespace mips { namespace jtype {

jtype_instr::jtype_instr(const sasm::elf::elf& elf, uint64 addr)
  : mips_instr(elf, addr)
{
  auto instr = elf.image.read<uint32>(addr);

  _target_val = MIPS_JTYPE_EXTRACT_TARGET(instr);
}

void jtype_instr::dump_asm(std::ostream& out) const
{
  _dump_addr(out);
  out << _name << " " << _get_abs_addr(_target_val << 2) << std::endl;
}

}}}}
<commit_msg>Fix a bug with J-type target address calculation.<commit_after>#include "instr.h"

#define MIPS_JTYPE_EXTRACT_TARGET(Instr) (Instr & ((1 << 26) - 1))

namespace sasm { namespace instr { namespace mips { namespace jtype {

jtype_instr::jtype_instr(const sasm::elf::elf& elf, uint64 addr)
  : mips_instr(elf, addr)
{
  auto instr = elf.image.read<uint32>(addr);

  _target_val = MIPS_JTYPE_EXTRACT_TARGET(instr);
}

void jtype_instr::dump_asm(std::ostream& out) const
{
  _dump_addr(out);
  uint32 dst_addr = (_target_val << 2) + ((_addr >> 28) << 28);
  out << _name << " " << _get_abs_addr(dst_addr) << std::endl;
}

}}}}

{'fraction_non_alphanumeric': 0.1605902777777778, 'fraction_numerical': 0.020833333333333332, 'mean_word_length': 5.335164835164835, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4644850', 'n_tokens_mistral': 466, 'n_tokens_neox': 440, 'n_words': 89}