mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-12 11:31:16 +00:00
24bce16c4d
Fix carry flag calculation. Anding with the rotation count (n = rB) is nonsensical. (r & ~mask) is the rotated word ANDed with the complement of the generated mask of n zeros followed by 32 - n ones. The manual says this 32-bit result is ORed together. This means all the bits are ORed together which is equivalent to saying 0 if all zeros and 1 if any ones. In other words: (r & ~mask) != 0. This boolean is ANDed with bit 0 of rS to produce the carry. int32_t(rS) < 0 will test bit 0. The && operator will treat each side as a boolean so you can exclude "!= 0" tests.