wwylele / teakra

DSi/3DS DSP emulator, disassembler, assembler, and tester
MIT License
76 stars 19 forks source link

interpreter: Correct assignment within MinMaxVtr() #23

Closed lioncash closed 5 years ago

lioncash commented 5 years ago

Made more than anything to bring this up.

It's very unlikely assignment here is intended, and even if this is wrong it is indeed intended, it's very non-idiomatic C++ (and matches a classic error in ternary statements, and should have a comment indicating that it's very intended).

wwylele commented 5 years ago

The assignment here is intended (see test results). wh/wl >> 63 is the sign bit of the difference (i.e. the comparison result) and is piped to the carry flags fc. The carry flags then determine which one is smaller/larger to store into the accumulator.

I should probably have separated the statements to make it clear.

lioncash commented 5 years ago

separated them to make it more obvious