Skip to content

Commit

Permalink
Properly adjusting hi16's addend relocation.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasnoble committed Jan 26, 2024
1 parent 64863fe commit d484cb0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tools/psyq-obj-parser/psyq-obj-parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1338,6 +1338,7 @@ bool PsyqLnkFile::Relocation::generateElf(ElfRelocationPass pass, const std::str
uint8_t* sectionData = (uint8_t*)malloc(size);
memcpy(sectionData, section->section->get_data(), size);
fmt::print(" :: Altering bytestream to account for HI symbol+addend relocation\n");
if (addend < 0) addend += 0x10000;

Check warning on line 1341 in tools/psyq-obj-parser/psyq-obj-parser.cc

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ Getting worse: Complex Method

PsyqLnkFile::Relocation::generateElf increases in cyclomatic complexity from 54 to 55, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
addend >>= 16;
sectionData[offset + 0] = addend & 0xff;
addend >>= 8;
Expand Down

0 comments on commit d484cb0

Please sign in to comment.