1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-06 13:31:55 +00:00

Eliminate BiggerInt.

This commit is contained in:
Thomas Harte 2022-10-11 16:19:47 -04:00
parent 28093196b9
commit 1f19141746
2 changed files with 14 additions and 19 deletions

View File

@ -22,18 +22,6 @@ namespace M68k {
namespace Primitive {
/// Provides a type alias, @c type, which is an unsigned int bigger than @c IntT.
template <typename IntT> struct BiggerInt {};
template <> struct BiggerInt<uint8_t> {
using type = uint16_t;
};
template <> struct BiggerInt<uint16_t> {
using type = uint32_t;
};
template <> struct BiggerInt<uint32_t> {
using type = uint64_t;
};
/// @returns An int of type @c IntT with only the most-significant bit set.
template <typename IntT> constexpr IntT top_bit() {
static_assert(!std::numeric_limits<IntT>::is_signed);

View File

@ -307,7 +307,8 @@ struct TestProcessor: public CPU::MC68000Mk2::BusHandler {
if(!address || !value) break;
XCTAssertEqual(test68000->ram[address.integerValue ^ 1], value.integerValue, @"%@: Memory at location %@ inconsistent", name, address);
if(test68000->ram[address.integerValue ^ 1] != value.integerValue) [_failures addObject:name];
if(test68000->ram[address.integerValue ^ 1] != value.integerValue)
[_failures addObject:name];
}
// Consider collating extra detail.
@ -359,7 +360,8 @@ struct TestProcessor: public CPU::MC68000Mk2::BusHandler {
NSNumber *const value = [enumerator nextObject];
if(!address || !value) break;
if(_testExecutor->ram[address.integerValue] != value.integerValue) [_failures addObject:name];
if(_testExecutor->ram[address.integerValue] != value.integerValue)
[_failures addObject:name];
}
// If this test is now in the failures set, add the corresponding opcode for
@ -425,12 +427,17 @@ struct TestProcessor: public CPU::MC68000Mk2::BusHandler {
const NSString *dX = [@"d" stringByAppendingFormat:@"%d", c];
const NSString *aX = [@"a" stringByAppendingFormat:@"%d", c];
if(registers.data[c] != [finalState[dX] integerValue]) [_failures addObject:name];
if(c < 7 && registers.address[c] != [finalState[aX] integerValue]) [_failures addObject:name];
if(registers.data[c] != [finalState[dX] integerValue])
[_failures addObject:name];
if(c < 7 && registers.address[c] != [finalState[aX] integerValue])
[_failures addObject:name];
}
if(registers.supervisor_stack_pointer != [finalState[@"a7"] integerValue]) [_failures addObject:name];
if(registers.user_stack_pointer != [finalState[@"usp"] integerValue]) [_failures addObject:name];
if(registers.program_counter + pcOffset != [finalState[@"pc"] integerValue]) [_failures addObject:name];
if(registers.supervisor_stack_pointer != [finalState[@"a7"] integerValue])
[_failures addObject:name];
if(registers.user_stack_pointer != [finalState[@"usp"] integerValue])
[_failures addObject:name];
if(registers.program_counter + pcOffset != [finalState[@"pc"] integerValue])
[_failures addObject:name];
const uint16_t correctSR = [finalState[@"sr"] integerValue];
if(registers.status != correctSR) {