added global FORCE_INLINE macro

used FORCE_INLINE macro in Thumbulator
This commit is contained in:
Thomas Jentzsch 2022-11-29 09:23:39 +01:00
parent 866ee840de
commit 38e8121b10
2 changed files with 11 additions and 5 deletions

View File

@ -134,6 +134,12 @@ namespace BSPF
static const string ARCH = "NOARCH";
#endif
#if defined(BSPF_WINDOWS)
#define FORCE_INLINE __forceinline
#else
#define FORCE_INLINE __attribute__((always_inline))
#endif
// Get next power of two greater than or equal to the given value
inline constexpr size_t nextPowerOfTwo(size_t size) {
if(size < 2) return 1;

View File

@ -291,7 +291,7 @@ void Thumbulator::dump_regs()
#endif
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 Thumbulator::fetch16(uInt32 addr)
FORCE_INLINE uInt32 Thumbulator::fetch16(uInt32 addr)
{
#ifndef UNSAFE_OPTIMIZATIONS
uInt32 data = 0;
@ -553,7 +553,7 @@ void Thumbulator::write32(uInt32 addr, uInt32 data)
#ifndef UNSAFE_OPTIMIZATIONS
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Thumbulator::isInvalidROM(uInt32 addr) const
FORCE_INLINE bool Thumbulator::isInvalidROM(uInt32 addr) const
{
const uInt32 romStart = configuration == ConfigureFor::DPCplus ? 0xc00 : 0x750; // was 0x800
@ -561,7 +561,7 @@ bool Thumbulator::isInvalidROM(uInt32 addr) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Thumbulator::isInvalidRAM(uInt32 addr) const
FORCE_INLINE bool Thumbulator::isInvalidRAM(uInt32 addr) const
{
// Note: addr is already checked for RAM (0x4xxxxxxx)
switch(romSize) // CDFJ+ allows more than 8 KB RAM depending on ROM sizes
@ -580,7 +580,7 @@ bool Thumbulator::isInvalidRAM(uInt32 addr) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Thumbulator::isProtectedRAM(uInt32 addr)
FORCE_INLINE bool Thumbulator::isProtectedRAM(uInt32 addr)
{
// Protected is within the driver RAM.
// For CDF variations parts of the driver RAM are reused to hold the
@ -1138,7 +1138,7 @@ Thumbulator::Op Thumbulator::decodeInstructionWord(uint16_t inst, uInt32 pc) {
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
inline int Thumbulator::execute() // NOLINT (readability-function-size)
FORCE_INLINE int Thumbulator::execute() // NOLINT (readability-function-size)
{
uInt32 sp, inst, ra, rb, rc, rm, rd, rn, rs; // NOLINT