not sure if a union of an int and an std::opional is guaranteed to work
This commit is contained in:
parent
ba5916f750
commit
3dddae94c3
2 changed files with 4 additions and 6 deletions
4
cpu.cpp
4
cpu.cpp
|
@ -149,7 +149,7 @@ void cpu::setRegisterLowByte(const int nr, const bool word_mode, const uint16_t
|
|||
bool cpu::put_result(const gam_rc_t & g, const uint16_t value)
|
||||
{
|
||||
if (g.addr.has_value() == false) {
|
||||
setRegisterLowByte(g.reg, g.word_mode, value);
|
||||
setRegisterLowByte(g.reg.value(), g.word_mode, value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ bool cpu::putGAM(const gam_rc_t & g, const uint16_t value)
|
|||
return g.addr.value() != ADDR_PSW;
|
||||
}
|
||||
|
||||
setRegister(g.reg, value, g.prev_mode);
|
||||
setRegister(g.reg.value(), value, g.prev_mode);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
6
cpu.h
6
cpu.h
|
@ -17,10 +17,8 @@ typedef struct {
|
|||
bool prev_mode;
|
||||
d_i_space_t space;
|
||||
|
||||
union {
|
||||
std::optional<uint16_t> addr;
|
||||
int reg;
|
||||
};
|
||||
std::optional<uint16_t> addr;
|
||||
std::optional<int> reg;
|
||||
|
||||
std::optional<uint16_t> value;
|
||||
} gam_rc_t;
|
||||
|
|
Loading…
Add table
Reference in a new issue