added a few more FORCE_INLINE and inline hints

This commit is contained in:
Thomas Jentzsch 2022-11-30 09:33:04 +01:00
parent 50d2155d1b
commit b1f100147f
14 changed files with 50 additions and 58 deletions

View File

@ -64,7 +64,7 @@ class BreakpointMap
BreakpointMap() = default;
bool isInitialized() const { return myInitialized; }
inline bool isInitialized() const { return myInitialized; }
/** Add new breakpoint */
void add(const Breakpoint& breakpoint, const uInt32 flags = 0);

View File

@ -139,7 +139,7 @@ class TimerMap
explicit TimerMap() = default;
bool isInitialized() const { return myList.size(); }
inline bool isInitialized() const { return myList.size(); }
/** Add new timer */
uInt32 add(uInt16 fromAddr, uInt16 toAddr,

View File

@ -25,8 +25,8 @@ class TrapArray
public:
TrapArray() = default;
bool isSet(const uInt16 address) const { return myCount[address]; }
bool isClear(const uInt16 address) const { return myCount[address] == 0; }
inline bool isSet(const uInt16 address) const { return myCount[address]; }
inline bool isClear(const uInt16 address) const { return myCount[address] == 0; }
void add(const uInt16 address) { myCount[address]++; }
void remove(const uInt16 address) { myCount[address]--; }
@ -39,7 +39,7 @@ class TrapArray
}
void clearAll() { myInitialized = false; myCount.fill(0); }
bool isInitialized() const { return myInitialized; }
inline bool isInitialized() const { return myInitialized; }
private:
// The actual counts

View File

@ -165,7 +165,7 @@ class Cartridge : public Device
@return Address of illegal access if one occurred, else 0
*/
uInt16 getIllegalRAMReadAccess() const {
inline uInt16 getIllegalRAMReadAccess() const {
return myRamReadAccesses.size() > 0 ? myRamReadAccesses[0] : 0;
}
@ -176,7 +176,7 @@ class Cartridge : public Device
@return Address of illegal access if one occurred, else 0
*/
uInt16 getIllegalRAMWriteAccess() const { return myRamWriteAccess; }
inline uInt16 getIllegalRAMWriteAccess() const { return myRamWriteAccess; }
/**
Query the access counters

View File

@ -101,14 +101,14 @@ class System : public Serializable
@return The attached 6532 microprocessor
*/
M6532& m6532() const { return myM6532; }
inline M6532& m6532() const { return myM6532; }
/**
Answer the TIA device attached to the system.
@return The attached TIA device
*/
TIA& tia() const { return myTIA; }
inline TIA& tia() const { return myTIA; }
/**
Answer the Cart attached to the system.
@ -140,14 +140,14 @@ class System : public Serializable
@return The number of system cycles which have passed
*/
uInt64 cycles() const { return myCycles; }
inline uInt64 cycles() const { return myCycles; }
/**
Increment the system cycles by the specified number of cycles.
@param amount The amount to add to the system cycles counter
*/
void incrementCycles(uInt32 amount) { myCycles += amount; }
inline void incrementCycles(uInt32 amount) { myCycles += amount; }
/**
Informs all attached devices that the console type has changed.

View File

@ -61,28 +61,6 @@ void Audio::setAudioQueue(const shared_ptr<AudioQueue>& queue)
mySampleIndex = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Audio::tick()
{
switch (myCounter) {
case 9:
case 81:
myChannel0.phase0();
myChannel1.phase0();
break;
case 37:
case 149:
phase1();
break;
default:
break;
}
if (++myCounter == 228) myCounter = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Audio::phase1()
{
@ -117,18 +95,6 @@ void Audio::addSample(uInt8 sample0, uInt8 sample1)
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AudioChannel& Audio::channel0()
{
return myChannel0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AudioChannel& Audio::channel1()
{
return myChannel1;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Audio::save(Serializer& out) const
{

View File

@ -44,11 +44,11 @@ class Audio : public Serializable
#endif
}
void tick();
FORCE_INLINE void tick();
AudioChannel& channel0();
inline AudioChannel& channel0() { return myChannel0; }
AudioChannel& channel1();
inline AudioChannel& channel1() { return myChannel1; }
/**
Serializable methods (see that class for more information).
@ -85,4 +85,30 @@ class Audio : public Serializable
Audio& operator=(Audio&&) = delete;
};
// ############################################################################
// Implementation
// ############################################################################
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Audio::tick()
{
switch (myCounter) {
case 9:
case 81:
myChannel0.phase0();
myChannel1.phase0();
break;
case 37:
case 149:
phase1();
break;
default:
break;
}
if (++myCounter == 228) myCounter = 0;
}
#endif // TIA_AUDIO_HXX

View File

@ -39,7 +39,7 @@ class Background : public Serializable
void applyColorLoss();
uInt8 getColor() const { return myColor; }
inline uInt8 getColor() const { return myColor; }
/**
Serializable methods (see that class for more information).

View File

@ -123,12 +123,12 @@ class Ball : public Serializable
Is the ball visible? This is determined by looking at bit 15
of the collision mask.
*/
bool isOn() const { return (collision & 0x8000); }
inline bool isOn() const { return (collision & 0x8000); }
/**
Get the current color.
*/
uInt8 getColor() const { return myColor; }
inline uInt8 getColor() const { return myColor; }
/**
Shuffle the enabled flag. This is called in VDELBL mode when GRP1 is

View File

@ -64,7 +64,7 @@ class Missile : public Serializable
void toggleEnabled(bool enabled);
bool isOn() const { return (collision & 0x8000); }
inline bool isOn() const { return (collision & 0x8000); }
uInt8 getColor() const;
uInt8 getPosition() const;

View File

@ -66,7 +66,7 @@ class Player : public Serializable
uInt8 getClock() const { return myCounter; }
bool isOn() const { return (collision & 0x8000); }
inline bool isOn() const { return (collision & 0x8000); }
uInt8 getColor() const;
void shufflePatterns();

View File

@ -118,7 +118,7 @@ class Playfield : public Serializable
Is the playfield visible? This is determined by looking at bit 15
of the collision mask.
*/
bool isOn() const { return (collision & 0x8000); }
inline bool isOn() const { return (collision & 0x8000); }
/**
Get the current color.

View File

@ -1591,7 +1591,7 @@ void TIA::scheduleCollisionUpdate()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::updateCollision()
FORCE_INLINE void TIA::updateCollision()
{
myCollisionMask |= (
myPlayer0.collision &
@ -1604,7 +1604,7 @@ void TIA::updateCollision()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::renderPixel(uInt32 x, uInt32 y)
FORCE_INLINE void TIA::renderPixel(uInt32 x, uInt32 y)
{
if (x >= TIAConstants::H_PIXEL) return;

View File

@ -78,7 +78,7 @@ class AbstractFrameManager : public Serializable
* Should the TIA render its frame? This is buffered in a flag for
* performance reasons; descendants must update the flag.
*/
bool isRendering() const { return myIsRendering; }
inline bool isRendering() const { return myIsRendering; }
/**
* Is vsync on?
@ -88,7 +88,7 @@ class AbstractFrameManager : public Serializable
/**
* Is vblank on?
*/
bool vblank() const { return myVblank; }
inline bool vblank() const { return myVblank; }
/**
* The number of scanlines in the last finished frame.