mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-13 03:30:31 +00:00
ppcopcodes: Cleanup ppc_changecrf0.
- Use one assignment to set ppc_state.cr. - Use enums for CR and XER bits. - Use < to check sign bit.
This commit is contained in:
parent
1e50d88183
commit
0273867c49
@ -33,20 +33,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
// Affects CR Field 0 - For integer operations
|
// Affects CR Field 0 - For integer operations
|
||||||
void ppc_changecrf0(uint32_t set_result) {
|
void ppc_changecrf0(uint32_t set_result) {
|
||||||
ppc_state.cr &= 0x0FFFFFFFUL;
|
ppc_state.cr =
|
||||||
|
(ppc_state.cr & 0x0FFFFFFFU) // clear CR0
|
||||||
if (set_result == 0) {
|
| (
|
||||||
ppc_state.cr |= 0x20000000UL;
|
(set_result == 0) ?
|
||||||
} else {
|
CRx_bit::CR_EQ
|
||||||
if (set_result & 0x80000000) {
|
: (int32_t(set_result) < 0) ?
|
||||||
ppc_state.cr |= 0x80000000UL;
|
CRx_bit::CR_LT
|
||||||
} else {
|
:
|
||||||
ppc_state.cr |= 0x40000000UL;
|
CRx_bit::CR_GT
|
||||||
}
|
)
|
||||||
}
|
| ((ppc_state.spr[SPR::XER] & XER::SO) >> 3); // copy XER[SO] into CR0[SO].
|
||||||
|
|
||||||
/* copy XER[SO] into CR0[SO]. */
|
|
||||||
ppc_state.cr |= (ppc_state.spr[SPR::XER] >> 3) & 0x10000000UL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Affects the XER register's Carry Bit
|
// Affects the XER register's Carry Bit
|
||||||
|
Loading…
x
Reference in New Issue
Block a user