From 66c2eb04143f6105ed4ff5be18956fe150cecfcd Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 12 May 2020 22:22:21 -0400 Subject: [PATCH] Further tightens `const` and `constexpr` usage. --- Components/9918/Implementation/9918Base.hpp | 2 +- Machines/Atari/2600/Atari2600.cpp | 4 ++-- Machines/KeyboardMachine.hpp | 4 ++-- Outputs/CRT/CRT.hpp | 2 +- Processors/68000/68000.hpp | 2 +- Processors/68000/Implementation/68000Storage.hpp | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Components/9918/Implementation/9918Base.hpp b/Components/9918/Implementation/9918Base.hpp index 1292b403f..6fff286da 100644 --- a/Components/9918/Implementation/9918Base.hpp +++ b/Components/9918/Implementation/9918Base.hpp @@ -51,7 +51,7 @@ class Base { } protected: - const static int output_lag = 11; // i.e. pixel output will occur 11 cycles after corresponding data read. + static constexpr int output_lag = 11; // i.e. pixel output will occur 11 cycles after corresponding data read. // The default TMS palette. const uint32_t palette[16] = { diff --git a/Machines/Atari/2600/Atari2600.cpp b/Machines/Atari/2600/Atari2600.cpp index 2580c428d..6906b72ab 100644 --- a/Machines/Atari/2600/Atari2600.cpp +++ b/Machines/Atari/2600/Atari2600.cpp @@ -29,8 +29,8 @@ #include "Cartridges/Unpaged.hpp" namespace { - static const double NTSC_clock_rate = 1194720; - static const double PAL_clock_rate = 1182298; + static constexpr double NTSC_clock_rate = 1194720; + static constexpr double PAL_clock_rate = 1182298; } namespace Atari2600 { diff --git a/Machines/KeyboardMachine.hpp b/Machines/KeyboardMachine.hpp index fc83ded7b..bd90ded02 100644 --- a/Machines/KeyboardMachine.hpp +++ b/Machines/KeyboardMachine.hpp @@ -121,13 +121,13 @@ class MappedKeyboardMachine: public Inputs::Keyboard::Delegate, public KeyboardM }; /// Terminates a key sequence from the character mapper. - static const uint16_t KeyEndSequence = 0xffff; + static constexpr uint16_t KeyEndSequence = 0xffff; /*! Indicates that a key is not mapped (for the keyboard mapper) or that a character cannot be typed (for the character mapper). */ - static const uint16_t KeyNotMapped = 0xfffe; + static constexpr uint16_t KeyNotMapped = 0xfffe; /*! Allows individual machines to provide the mapping between host keys diff --git a/Outputs/CRT/CRT.hpp b/Outputs/CRT/CRT.hpp index d640b01a7..2e6f34e22 100644 --- a/Outputs/CRT/CRT.hpp +++ b/Outputs/CRT/CRT.hpp @@ -83,7 +83,7 @@ class CRT { Outputs::Display::ScanTarget *scan_target_ = &Outputs::Display::NullScanTarget::singleton; Outputs::Display::ScanTarget::Modals scan_target_modals_; - static const uint8_t DefaultAmplitude = 80; + static constexpr uint8_t DefaultAmplitude = 80; #ifndef NDEBUG size_t allocated_data_length_ = std::numeric_limits::min(); diff --git a/Processors/68000/68000.hpp b/Processors/68000/68000.hpp index 6a7f0399b..afc90b8af 100644 --- a/Processors/68000/68000.hpp +++ b/Processors/68000/68000.hpp @@ -91,7 +91,7 @@ struct Microcycle { /// Provides the 68000's bus grant line — indicating whether a bus request has been acknowledged. static constexpr int BusGrant = 1 << 10; - /// Contains a valid combination of the various static const int flags, describing the operation + /// Contains a valid combination of the various static constexpr int flags, describing the operation /// performed by this Microcycle. int operation = 0; diff --git a/Processors/68000/Implementation/68000Storage.hpp b/Processors/68000/Implementation/68000Storage.hpp index 79971d479..913deb09f 100644 --- a/Processors/68000/Implementation/68000Storage.hpp +++ b/Processors/68000/Implementation/68000Storage.hpp @@ -323,7 +323,7 @@ class ProcessorStorage { static constexpr int DestinationMask = 1 << 6; uint8_t action = uint8_t(Action::None); - static const uint16_t NoBusProgram = std::numeric_limits::max(); + static constexpr uint16_t NoBusProgram = std::numeric_limits::max(); uint16_t bus_program = NoBusProgram; MicroOp() {}