mirror of
https://github.com/TomHarte/CLK.git
synced 2024-09-29 00:56:21 +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 <typename BusHandlerT, Personality personality>
|
||||||
template <int port> uint8_t MOS6526<BusHandlerT, personality>::get_port_input() {
|
template <int port> uint8_t MOS6526<BusHandlerT, personality>::get_port_input() {
|
||||||
const uint8_t input = port_handler_.get_port_input(Port(port));
|
// Avoid bothering the port handler if there's no input active.
|
||||||
return (input & ~data_direction_[port]) | (output_[port] & data_direction_[port]);
|
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>
|
template <typename BusHandlerT, Personality personality>
|
||||||
|
Loading…
Reference in New Issue
Block a user