I was a little too eager with the 'constexpr'; it currently doesn't work on

enum types.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3300 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2016-04-02 21:27:10 +00:00
parent dd96a80e7e
commit abf4a4a44c
11 changed files with 32 additions and 22 deletions

View File

@ -363,3 +363,8 @@ uInt8 CartridgeDASHWidget::internalRamGetValue(int addr)
{
return myCart.myRAM[addr];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const CartridgeDASHWidget::BankID CartridgeDASHWidget::bankEnum[4] = {
kBank0Changed, kBank1Changed, kBank2Changed, kBank3Changed
};

View File

@ -57,10 +57,7 @@ class CartridgeDASHWidget : public CartDebugWidget
kBank2Changed = 'b2CH',
kBank3Changed = 'b3CH'
};
static constexpr BankID bankEnum[4] = {
kBank0Changed, kBank1Changed, kBank2Changed, kBank3Changed
};
static const BankID bankEnum[4];
private:
void saveOldState() override;

View File

@ -92,7 +92,7 @@ inline void CartridgeDPC::clockRandomNumberGenerator()
{
// Table for computing the input bit of the random number generator's
// shift register (it's the NOT of the EOR of four bits)
static const uInt8 f[16] = {
static constexpr uInt8 f[16] = {
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1
};
@ -204,7 +204,7 @@ uInt8 CartridgeDPC::peek(uInt16 address)
// No, it's a music read
else
{
static const uInt8 musicAmplitudes[8] = {
static constexpr uInt8 musicAmplitudes[8] = {
0x00, 0x04, 0x05, 0x09, 0x06, 0x0a, 0x0b, 0x0f
};

View File

@ -124,7 +124,7 @@ void Driving::update()
}
// Gray codes for rotation
static const uInt8 graytable[] = { 0x03, 0x01, 0x00, 0x02 };
static constexpr uInt8 graytable[] = { 0x03, 0x01, 0x00, 0x02 };
// Determine which bits are set
uInt8 gray = graytable[myGrayIndex];

View File

@ -284,7 +284,7 @@ bool M6532::poke(uInt16 addr, uInt8 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void M6532::setTimerRegister(uInt8 value, uInt8 interval)
{
static const uInt8 shift[] = { 0, 3, 6, 10 };
static constexpr uInt8 shift[] = { 0, 3, 6, 10 };
myIntervalShift = shift[interval];
myOutTimer[interval] = value;

View File

@ -419,3 +419,6 @@ int Paddles::TRIGRANGE = Paddles::TRIGMAX;
int Paddles::DIGITAL_SENSITIVITY = -1;
int Paddles::DIGITAL_DISTANCE = -1;
int Paddles::MOUSE_SENSITIVITY = -1;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const Controller::DigitalPin Paddles::ourButtonPin[2] = { Four, Three };

View File

@ -128,17 +128,18 @@ class Paddles : public Controller
// Range of values over which digital and mouse movement is scaled
// to paddle resistance
static constexpr int TRIGMIN = 1;
static constexpr int TRIGMAX = 4096;
static const int TRIGMIN = 1;
static const int TRIGMAX = 4096;
static int TRIGRANGE; // This one is variable for the upper range
static constexpr int MAX_DIGITAL_SENSE = 20;
static constexpr int MAX_MOUSE_SENSE = 20;
static const int MAX_DIGITAL_SENSE = 20;
static const int MAX_MOUSE_SENSE = 20;
static int DIGITAL_SENSITIVITY, DIGITAL_DISTANCE;
static int MOUSE_SENSITIVITY;
// Lookup table for associating paddle buttons with controller pins
static constexpr Controller::DigitalPin ourButtonPin[2] = { Four, Three };
// Yes, this is hideously complex
static const Controller::DigitalPin ourButtonPin[2];
private:
// Following constructors and assignment operators not supported

View File

@ -308,3 +308,8 @@ void GlobalPropsDialog::handleCommand(CommandSender* sender, int cmd,
break;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const char* GlobalPropsDialog::ourJoyState[10] = {
"U", "D", "L", "R", "F", "U", "D", "L", "R", "F"
};

View File

@ -60,10 +60,7 @@ class GlobalPropsDialog : public Dialog, public CommandSender
CheckboxWidget* myHoldSelect;
CheckboxWidget* myHoldReset;
static constexpr char* ourJoyState[10] = {
"U", "D", "L", "R", "F", "U", "D", "L", "R", "F"
};
static const char* ourJoyState[10];
private:
// Following constructors and assignment operators not supported

View File

@ -249,3 +249,9 @@ void LauncherFilterDialog::handleCommand(CommandSender* sender, int cmd,
break;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const char* LauncherFilterDialog::ourRomTypes[2][5] = {
{ ".a26", ".bin", ".rom", ".zip", ".gz" },
{ "a26", "bin", "rom", "zip", "gz" }
};

View File

@ -74,11 +74,7 @@ class LauncherFilterDialog : public Dialog, public CommandSender
};
// Holds static strings representing ROM types
static constexpr char* ourRomTypes[2][5] = {
{ ".a26", ".bin", ".rom", ".zip", ".gz" },
{ "a26", "bin", "rom", "zip", "gz" }
};
static const char* ourRomTypes[2][5];
private:
// Following constructors and assignment operators not supported