mirror of https://github.com/stella-emu/stella.git
Changed 'const' to 'constexpr' in several places.
Note that constexpr should be preferred, since it _guarantees_ compile-time usage, whereas 'const' alone doesn't necessarily do that. So constexpr is guaranteed to be more efficient.
This commit is contained in:
parent
a636e6859d
commit
178c5b4eaf
|
@ -82,7 +82,7 @@ class CartridgeE7 : public CartridgeMNetwork
|
||||||
void checkSwitchBank(uInt16 address) override;
|
void checkSwitchBank(uInt16 address) override;
|
||||||
|
|
||||||
// Number of banks
|
// Number of banks
|
||||||
static const uInt32 BANK_COUNT = 8;
|
static constexpr uInt32 BANK_COUNT = 8;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Following constructors and assignment operators not supported
|
// Following constructors and assignment operators not supported
|
||||||
|
|
|
@ -80,7 +80,7 @@ class CartridgeE78K : public CartridgeMNetwork
|
||||||
void checkSwitchBank(uInt16 address) override;
|
void checkSwitchBank(uInt16 address) override;
|
||||||
|
|
||||||
// Number of banks
|
// Number of banks
|
||||||
static const uInt32 BANK_COUNT = 4;
|
static constexpr uInt32 BANK_COUNT = 4;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Following constructors and assignment operators not supported
|
// Following constructors and assignment operators not supported
|
||||||
|
|
|
@ -23,8 +23,10 @@ CartridgeMNetwork::CartridgeMNetwork(const BytePtr& image, uInt32 size,
|
||||||
const Settings& settings)
|
const Settings& settings)
|
||||||
: Cartridge(settings),
|
: Cartridge(settings),
|
||||||
myCurrentRAM(0)
|
myCurrentRAM(0)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void CartridgeMNetwork::initialize(const BytePtr& image, uInt32 size)
|
void CartridgeMNetwork::initialize(const BytePtr& image, uInt32 size)
|
||||||
{
|
{
|
||||||
// Copy the ROM image into my buffer
|
// Copy the ROM image into my buffer
|
||||||
|
@ -54,8 +56,9 @@ void CartridgeMNetwork::reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void CartridgeMNetwork::setAccess(uInt16 addrFrom, uInt16 size, uInt16 directOffset, uInt8* directData,
|
void CartridgeMNetwork::setAccess(uInt16 addrFrom, uInt16 size,
|
||||||
uInt16 codeOffset, System::PageAccessType type, uInt16 addrMask)
|
uInt16 directOffset, uInt8* directData, uInt16 codeOffset,
|
||||||
|
System::PageAccessType type, uInt16 addrMask)
|
||||||
{
|
{
|
||||||
if(addrMask == 0)
|
if(addrMask == 0)
|
||||||
addrMask = size - 1;
|
addrMask = size - 1;
|
||||||
|
@ -90,7 +93,7 @@ void CartridgeMNetwork::install(System& system)
|
||||||
0, nullptr, 0x1fc0, System::PA_NONE, 0x1fc0);*/
|
0, nullptr, 0x1fc0, System::PA_NONE, 0x1fc0);*/
|
||||||
|
|
||||||
// Setup the second segment to always point to the last ROM slice
|
// Setup the second segment to always point to the last ROM slice
|
||||||
setAccess(0x1A00, 0x1FE0U & ~System::PAGE_MASK - 0x1A00,
|
setAccess(0x1A00, 0x1FE0U & (~System::PAGE_MASK - 0x1A00),
|
||||||
myRAMSlice * BANK_SIZE, myImage, myRAMSlice * BANK_SIZE, System::PA_READ, BANK_SIZE - 1);
|
myRAMSlice * BANK_SIZE, myImage, myRAMSlice * BANK_SIZE, System::PA_READ, BANK_SIZE - 1);
|
||||||
myCurrentSlice[1] = myRAMSlice;
|
myCurrentSlice[1] = myRAMSlice;
|
||||||
|
|
||||||
|
|
|
@ -165,13 +165,13 @@ class CartridgeMNetwork : public Cartridge
|
||||||
void bankRAM(uInt16 bank);
|
void bankRAM(uInt16 bank);
|
||||||
|
|
||||||
// Size of a ROM or RAM bank
|
// Size of a ROM or RAM bank
|
||||||
static const uInt32 BANK_SIZE = 0x800; // 2K
|
static constexpr uInt32 BANK_SIZE = 0x800; // 2K
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Size of RAM in the cart
|
// Size of RAM in the cart
|
||||||
static const uInt32 RAM_SIZE = 0x800; // 1K + 4 * 256B = 2K
|
static constexpr uInt32 RAM_SIZE = 0x800; // 1K + 4 * 256B = 2K
|
||||||
// Number of slices with 4K address space
|
// Number of slices with 4K address space
|
||||||
static const uInt32 NUM_SEGMENTS = 2;
|
static constexpr uInt32 NUM_SEGMENTS = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Query the size of the BS type.
|
Query the size of the BS type.
|
||||||
|
|
Loading…
Reference in New Issue