Fix MoveRegister to clear when value is 0

The register wouldn't be cleared with a `MOVZ` when a value was zero due to the condition for writing an instruction requiring the `offsetValue` to be non-zero.
This commit is contained in:
PixelyIon 2022-11-05 21:52:27 +05:30
parent f7ab3abb86
commit 8892eb08e6

View File

@ -257,13 +257,11 @@ namespace skyline::nce {
for (auto &instruction : instructions) {
auto offsetValue{*(valuePointer + offset)};
if (offsetValue) {
if (zeroed) {
instruction = instructions::Movk(destination, offsetValue, offset).raw;
} else {
if (!zeroed) {
instruction = instructions::Movz(destination, offsetValue, offset).raw;
zeroed = true;
}
} else if (offsetValue && zeroed) {
instruction = instructions::Movk(destination, offsetValue, offset).raw;
} else {
instruction = 0;
}