From 5c6e68167332b362a2479a9ee427fefab0839874 Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Tue, 14 Apr 2020 14:19:38 -0700 Subject: [PATCH] Use static constexpr instead of static const where possible. In particular inside class declarations, a static const assignment is technically not a definition, while constexpr is. Signed-off-by: Henner Zeller --- libs/sha1/sha1.h | 6 +++--- libs/subcircuit/subcircuit.cc | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/libs/sha1/sha1.h b/libs/sha1/sha1.h index 9f526376e..b1346b548 100644 --- a/libs/sha1/sha1.h +++ b/libs/sha1/sha1.h @@ -35,9 +35,9 @@ public: static std::string from_file(const std::string &filename); private: - static const unsigned int DIGEST_INTS = 5; /* number of 32bit integers per SHA1 digest */ - static const unsigned int BLOCK_INTS = 16; /* number of 32bit integers per SHA1 block */ - static const unsigned int BLOCK_BYTES = BLOCK_INTS * 4; + static constexpr unsigned int DIGEST_INTS = 5; /* number of 32bit integers per SHA1 digest */ + static constexpr unsigned int BLOCK_INTS = 16; /* number of 32bit integers per SHA1 block */ + static constexpr unsigned int BLOCK_BYTES = BLOCK_INTS * 4; uint32_t digest[DIGEST_INTS]; std::string buffer; diff --git a/libs/subcircuit/subcircuit.cc b/libs/subcircuit/subcircuit.cc index e8361a67e..4068dc09a 100644 --- a/libs/subcircuit/subcircuit.cc +++ b/libs/subcircuit/subcircuit.cc @@ -316,7 +316,7 @@ class SubCircuit::SolverWorker // helper functions for handling permutations - static const int maxPermutationsLimit = 1000000; + static constexpr int maxPermutationsLimit = 1000000; static int numberOfPermutations(const std::vector &list) { @@ -1689,4 +1689,3 @@ void SubCircuit::Solver::clearConfig() { worker->clearConfig(); } -