mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-12 00:30:31 +00:00
Avoid unnecessary get_port_input
calls.
This commit is contained in:
parent
2a7a42ff8f
commit
55af6681af
@ -31,8 +31,10 @@ template <int port> void MOS6526<BusHandlerT, personality>::set_port_output() {
|
||||
|
||||
template <typename BusHandlerT, Personality personality>
|
||||
template <int port> uint8_t MOS6526<BusHandlerT, personality>::get_port_input() {
|
||||
const uint8_t input = port_handler_.get_port_input(Port(port));
|
||||
return (input & ~data_direction_[port]) | (output_[port] & data_direction_[port]);
|
||||
// Avoid bothering the port handler if there's no input active.
|
||||
const uint8_t input_mask = ~data_direction_[port];
|
||||
const uint8_t input = input_mask ? port_handler_.get_port_input(Port(port)) : 0x00;
|
||||
return (input & input_mask) | (output_[port] & data_direction_[port]);
|
||||
}
|
||||
|
||||
template <typename BusHandlerT, Personality personality>
|
||||
|
Loading…
x
Reference in New Issue
Block a user