diff --git a/include/etl/atomic/atomic_std.h b/include/etl/atomic/atomic_std.h index 7dce3647..91ac2184 100644 --- a/include/etl/atomic/atomic_std.h +++ b/include/etl/atomic/atomic_std.h @@ -45,12 +45,12 @@ namespace etl typedef std::memory_order memory_order; - static const etl::memory_order memory_order_relaxed = std::memory_order_relaxed; - static const etl::memory_order memory_order_consume = std::memory_order_consume; - static const etl::memory_order memory_order_acquire = std::memory_order_acquire; - static const etl::memory_order memory_order_release = std::memory_order_release; - static const etl::memory_order memory_order_acq_rel = std::memory_order_acq_rel; - static const etl::memory_order memory_order_seq_cst = std::memory_order_seq_cst; + static ETL_CONSTANT etl::memory_order memory_order_relaxed = std::memory_order_relaxed; + static ETL_CONSTANT etl::memory_order memory_order_consume = std::memory_order_consume; + static ETL_CONSTANT etl::memory_order memory_order_acquire = std::memory_order_acquire; + static ETL_CONSTANT etl::memory_order memory_order_release = std::memory_order_release; + static ETL_CONSTANT etl::memory_order memory_order_acq_rel = std::memory_order_acq_rel; + static ETL_CONSTANT etl::memory_order memory_order_seq_cst = std::memory_order_seq_cst; template class atomic diff --git a/include/etl/basic_string.h b/include/etl/basic_string.h index 1c45bd4a..8467fc91 100644 --- a/include/etl/basic_string.h +++ b/include/etl/basic_string.h @@ -297,8 +297,8 @@ namespace etl { } - static const uint_least8_t IS_TRUNCATED = etl::bit<0>::value; - static const uint_least8_t CLEAR_AFTER_USE = etl::bit<1>::value; + static ETL_CONSTANT uint_least8_t IS_TRUNCATED = etl::bit<0>::value; + static ETL_CONSTANT uint_least8_t CLEAR_AFTER_USE = etl::bit<1>::value; size_type current_size; ///< The current number of elements in the string. const size_type CAPACITY; ///< The maximum number of elements in the string. diff --git a/include/etl/binary.h b/include/etl/binary.h index cebaa91f..62854473 100644 --- a/include/etl/binary.h +++ b/include/etl/binary.h @@ -85,7 +85,7 @@ namespace etl struct max_value_for_nbits { typedef typename etl::smallest_uint_for_bits::type value_type; - static const value_type value = (value_type(1) << (NBITS - 1)) | max_value_for_nbits::value; + static ETL_CONSTANT value_type value = (value_type(1) << (NBITS - 1)) | max_value_for_nbits::value; }; /// Specialisation for when NBITS == 0. @@ -93,7 +93,7 @@ namespace etl struct max_value_for_nbits<0> { typedef etl::smallest_uint_for_bits<0>::type value_type; - static const value_type value = 0; + static ETL_CONSTANT value_type value = 0; }; template @@ -357,7 +357,7 @@ namespace etl struct bit { typedef typename etl::smallest_uint_for_bits::type value_type; - static const value_type value = value_type(1) << POSITION; + static ETL_CONSTANT value_type value = value_type(1) << POSITION; }; template diff --git a/include/etl/bitset.h b/include/etl/bitset.h index d6b2401c..fdf8a2ce 100644 --- a/include/etl/bitset.h +++ b/include/etl/bitset.h @@ -137,10 +137,10 @@ namespace etl public: - static const element_t ALL_SET = etl::integral_limits::max; - static const element_t ALL_CLEAR = 0; + static ETL_CONSTANT element_t ALL_SET = etl::integral_limits::max; + static ETL_CONSTANT element_t ALL_CLEAR = 0; - static const size_t BITS_PER_ELEMENT = etl::integral_limits::bits; + static ETL_CONSTANT size_t BITS_PER_ELEMENT = etl::integral_limits::bits; #if ETL_CPP11_SUPPORTED typedef etl::span span_type; @@ -894,11 +894,11 @@ namespace etl class bitset : public etl::ibitset { - static const size_t ARRAY_SIZE = (MAXN % BITS_PER_ELEMENT == 0) ? MAXN / BITS_PER_ELEMENT : MAXN / BITS_PER_ELEMENT + 1; + static ETL_CONSTANT size_t ARRAY_SIZE = (MAXN % BITS_PER_ELEMENT == 0) ? MAXN / BITS_PER_ELEMENT : MAXN / BITS_PER_ELEMENT + 1; public: - static const size_t ALLOCATED_BITS = ARRAY_SIZE * BITS_PER_ELEMENT; + static ETL_CONSTANT size_t ALLOCATED_BITS = ARRAY_SIZE * BITS_PER_ELEMENT; public: diff --git a/include/etl/constant.h b/include/etl/constant.h index 633b5522..205e67d3 100644 --- a/include/etl/constant.h +++ b/include/etl/constant.h @@ -47,7 +47,7 @@ namespace etl typedef T value_type; - static const T value = VALUE; + static ETL_CONSTANT T value = VALUE; }; template diff --git a/include/etl/cumulative_moving_average.h b/include/etl/cumulative_moving_average.h index 3e49affc..b0aaf805 100644 --- a/include/etl/cumulative_moving_average.h +++ b/include/etl/cumulative_moving_average.h @@ -114,16 +114,16 @@ namespace etl typedef typename etl::conditional::value, int32_t, uint32_t>::type scale_t; typedef typename etl::conditional::value, int32_t, uint32_t>::type sample_t; - static const sample_t SAMPLES = static_cast(SAMPLE_SIZE_); - static const scale_t SCALE = static_cast(SCALING_); + static ETL_CONSTANT sample_t SAMPLES = static_cast(SAMPLE_SIZE_); + static ETL_CONSTANT scale_t SCALE = static_cast(SCALING_); public: typedef T value_type; typedef private_cumulative_moving_average::add_insert_iterator add_insert_iterator; - static const size_t SAMPLE_SIZE = SAMPLE_SIZE_; ///< The number of samples averaged over. - static const size_t SCALING = SCALING_; ///< The sample scaling factor. + static ETL_CONSTANT size_t SAMPLE_SIZE = SAMPLE_SIZE_; ///< The number of samples averaged over. + static ETL_CONSTANT size_t SCALING = SCALING_; ///< The sample scaling factor. //************************************************************************* /// Constructor @@ -191,14 +191,14 @@ namespace etl typedef typename etl::conditional::value, int32_t, uint32_t>::type scale_t; typedef typename etl::conditional::value, int32_t, uint32_t>::type sample_t; - static const scale_t SCALE = static_cast(SCALING_); + static ETL_CONSTANT scale_t SCALE = static_cast(SCALING_); public: typedef T value_type; typedef private_cumulative_moving_average::add_insert_iterator add_insert_iterator; - static const size_t SCALING = SCALING_; ///< The sample scaling factor. + static ETL_CONSTANT size_t SCALING = SCALING_; ///< The sample scaling factor. //************************************************************************* /// Constructor @@ -279,7 +279,7 @@ namespace etl typedef T value_type; typedef private_cumulative_moving_average::add_insert_iterator add_insert_iterator; - static const size_t SAMPLE_SIZE = SAMPLE_SIZE_; + static ETL_CONSTANT size_t SAMPLE_SIZE = SAMPLE_SIZE_; //************************************************************************* /// Constructor diff --git a/include/etl/flags.h b/include/etl/flags.h index 937342ef..717b156c 100644 --- a/include/etl/flags.h +++ b/include/etl/flags.h @@ -63,7 +63,7 @@ namespace etl static ETL_CONSTANT value_type ALL_SET = etl::integral_limits::max & MASK; static ETL_CONSTANT value_type ALL_CLEAR = 0; - static const size_t NBITS = etl::integral_limits::bits; + static ETL_CONSTANT size_t NBITS = etl::integral_limits::bits; //************************************************************************* /// Constructor diff --git a/include/etl/flat_map.h b/include/etl/flat_map.h index f6243742..3908999c 100644 --- a/include/etl/flat_map.h +++ b/include/etl/flat_map.h @@ -897,7 +897,7 @@ namespace etl { public: - static const size_t MAX_SIZE = MAX_SIZE_; + static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_; //************************************************************************* /// Constructor. diff --git a/include/etl/flat_multimap.h b/include/etl/flat_multimap.h index 5b7edf1e..81def0c1 100644 --- a/include/etl/flat_multimap.h +++ b/include/etl/flat_multimap.h @@ -800,7 +800,7 @@ namespace etl { public: - static const size_t MAX_SIZE = MAX_SIZE_; + static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_; //************************************************************************* /// Constructor. diff --git a/include/etl/flat_multiset.h b/include/etl/flat_multiset.h index 5833659b..9e0704da 100644 --- a/include/etl/flat_multiset.h +++ b/include/etl/flat_multiset.h @@ -752,7 +752,7 @@ namespace etl { public: - static const size_t MAX_SIZE = MAX_SIZE_; + static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_; //************************************************************************* /// Constructor. diff --git a/include/etl/flat_set.h b/include/etl/flat_set.h index 690b191d..fa1bc282 100644 --- a/include/etl/flat_set.h +++ b/include/etl/flat_set.h @@ -837,7 +837,7 @@ namespace etl { public: - static const size_t MAX_SIZE = MAX_SIZE_; + static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_; //************************************************************************* /// Constructor. diff --git a/include/etl/fnv_1.h b/include/etl/fnv_1.h index b7fae671..a6e51627 100644 --- a/include/etl/fnv_1.h +++ b/include/etl/fnv_1.h @@ -75,8 +75,8 @@ namespace etl return hash; } - static const uint64_t OFFSET_BASIS = 0xCBF29CE484222325ull; - static const uint64_t PRIME = 0x00000100000001b3ull; + static ETL_CONSTANT uint64_t OFFSET_BASIS = 0xCBF29CE484222325ull; + static ETL_CONSTANT uint64_t PRIME = 0x00000100000001b3ull; }; //*************************************************************************** @@ -133,8 +133,8 @@ namespace etl return hash; } - static const uint64_t OFFSET_BASIS = 0xCBF29CE484222325ull; - static const uint64_t PRIME = 0x00000100000001b3ull; + static ETL_CONSTANT uint64_t OFFSET_BASIS = 0xCBF29CE484222325ull; + static ETL_CONSTANT uint64_t PRIME = 0x00000100000001b3ull; }; //*************************************************************************** @@ -192,8 +192,8 @@ namespace etl return hash; } - static const uint32_t OFFSET_BASIS = 0x811C9DC5; - static const uint32_t PRIME = 0x01000193; + static ETL_CONSTANT uint32_t OFFSET_BASIS = 0x811C9DC5; + static ETL_CONSTANT uint32_t PRIME = 0x01000193; }; //*************************************************************************** @@ -250,8 +250,8 @@ namespace etl return hash; } - static const uint32_t OFFSET_BASIS = 0x811C9DC5; - static const uint32_t PRIME = 0x01000193; + static ETL_CONSTANT uint32_t OFFSET_BASIS = 0x811C9DC5; + static ETL_CONSTANT uint32_t PRIME = 0x01000193; }; //*************************************************************************** diff --git a/include/etl/forward_list.h b/include/etl/forward_list.h index 6ba204b6..27fb980f 100644 --- a/include/etl/forward_list.h +++ b/include/etl/forward_list.h @@ -1621,7 +1621,7 @@ namespace etl ETL_STATIC_ASSERT((MAX_SIZE_ > 0U), "Zero capacity etl::forward_list is not valid"); - static const size_t MAX_SIZE = MAX_SIZE_; + static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_; public: diff --git a/include/etl/generators/smallest_generator.h b/include/etl/generators/smallest_generator.h index 5bd7ef59..5dff3527 100644 --- a/include/etl/generators/smallest_generator.h +++ b/include/etl/generators/smallest_generator.h @@ -320,9 +320,9 @@ namespace etl private: // Determines the index of the best unsigned type for the required number of bits. - static const int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) + - ((NBITS > 16) ? 1 : 0) + - ((NBITS > 32) ? 1 : 0); + static ETL_CONSTANT int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) + + ((NBITS > 16) ? 1 : 0) + + ((NBITS > 32) ? 1 : 0); public: @@ -346,9 +346,9 @@ namespace etl private: // Determines the index of the best unsigned type for the required number of bits. - static const int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) + - ((NBITS > 16) ? 1 : 0) + - ((NBITS > 32) ? 1 : 0); + static ETL_CONSTANT int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) + + ((NBITS > 16) ? 1 : 0) + + ((NBITS > 32) ? 1 : 0); public: @@ -372,9 +372,9 @@ namespace etl private: // Determines the index of the best unsigned type for the required value. - static const int TYPE_INDEX = ((VALUE > UINT_LEAST8_MAX) ? 1 : 0) + - ((VALUE > UINT16_MAX) ? 1 : 0) + - ((VALUE > UINT32_MAX) ? 1 : 0); + static ETL_CONSTANT int TYPE_INDEX = ((VALUE > UINT_LEAST8_MAX) ? 1 : 0) + + ((VALUE > UINT16_MAX) ? 1 : 0) + + ((VALUE > UINT32_MAX) ? 1 : 0); public: @@ -398,9 +398,9 @@ namespace etl private: // Determines the index of the best signed type for the required value. - static const int TYPE_INDEX = (((VALUE > intmax_t(INT_LEAST8_MAX)) || (VALUE < intmax_t(INT_LEAST8_MIN))) ? 1 : 0) + - (((VALUE > intmax_t(INT16_MAX)) || (VALUE < intmax_t(INT16_MIN))) ? 1 : 0) + - (((VALUE > intmax_t(INT32_MAX)) || (VALUE < intmax_t(INT32_MIN))) ? 1 : 0); + static ETL_CONSTANT int TYPE_INDEX = (((VALUE > intmax_t(INT_LEAST8_MAX)) || (VALUE < intmax_t(INT_LEAST8_MIN))) ? 1 : 0) + + (((VALUE > intmax_t(INT16_MAX)) || (VALUE < intmax_t(INT16_MIN))) ? 1 : 0) + + (((VALUE > intmax_t(INT32_MAX)) || (VALUE < intmax_t(INT32_MIN))) ? 1 : 0); public: diff --git a/include/etl/generic_pool.h b/include/etl/generic_pool.h index b8aa9a8a..9979e425 100644 --- a/include/etl/generic_pool.h +++ b/include/etl/generic_pool.h @@ -187,7 +187,7 @@ namespace etl ///< The memory for the pool of objects. typename etl::aligned_storage::value>::type buffer[VSize]; - static const uint32_t Element_Size = sizeof(Element); + static ETL_CONSTANT uint32_t Element_Size = sizeof(Element); // Should not be copied. generic_pool(const generic_pool&); diff --git a/include/etl/indirect_vector.h b/include/etl/indirect_vector.h index b5a5e8fa..947c1b9d 100644 --- a/include/etl/indirect_vector.h +++ b/include/etl/indirect_vector.h @@ -1294,7 +1294,7 @@ namespace etl ETL_STATIC_ASSERT((MAX_SIZE_ > 0U), "Zero capacity etl::indirect_vector is not valid"); - static const size_t MAX_SIZE = MAX_SIZE_; + static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_; //************************************************************************* /// Constructor. diff --git a/include/etl/integral_limits.h b/include/etl/integral_limits.h index 7b8d4dd0..bfd54ce3 100644 --- a/include/etl/integral_limits.h +++ b/include/etl/integral_limits.h @@ -59,10 +59,10 @@ namespace etl template <> struct integral_limits { - static const int min = 0; - static const int max = 0; - static const int bits = 0; - static const bool is_signed = false; + static ETL_CONSTANT int min = 0; + static ETL_CONSTANT int max = 0; + static ETL_CONSTANT int bits = 0; + static ETL_CONSTANT bool is_signed = false; }; //*************************************************************************** @@ -71,10 +71,10 @@ namespace etl template <> struct integral_limits { - static const signed char min = SCHAR_MIN; - static const signed char max = SCHAR_MAX; - static const int bits = CHAR_BIT; - static const bool is_signed = etl::is_signed::value; + static ETL_CONSTANT signed char min = SCHAR_MIN; + static ETL_CONSTANT signed char max = SCHAR_MAX; + static ETL_CONSTANT int bits = CHAR_BIT; + static ETL_CONSTANT bool is_signed = etl::is_signed::value; }; //*************************************************************************** @@ -83,10 +83,10 @@ namespace etl template <> struct integral_limits { - static const unsigned char min = 0; - static const unsigned char max = UCHAR_MAX; - static const int bits = CHAR_BIT; - static const bool is_signed = etl::is_signed::value; + static ETL_CONSTANT unsigned char min = 0; + static ETL_CONSTANT unsigned char max = UCHAR_MAX; + static ETL_CONSTANT int bits = CHAR_BIT; + static ETL_CONSTANT bool is_signed = etl::is_signed::value; }; //*************************************************************************** @@ -95,10 +95,10 @@ namespace etl template <> struct integral_limits { - static const char min = (etl::is_signed::value) ? SCHAR_MIN : 0; - static const char max = (etl::is_signed::value) ? SCHAR_MAX : char(UCHAR_MAX); - static const int bits = CHAR_BIT; - static const bool is_signed = etl::is_signed::value; + static ETL_CONSTANT char min = (etl::is_signed::value) ? SCHAR_MIN : 0; + static ETL_CONSTANT char max = (etl::is_signed::value) ? SCHAR_MAX : char(UCHAR_MAX); + static ETL_CONSTANT int bits = CHAR_BIT; + static ETL_CONSTANT bool is_signed = etl::is_signed::value; }; //*************************************************************************** @@ -107,10 +107,10 @@ namespace etl template <> struct integral_limits { - static const short min = SHRT_MIN; - static const short max = SHRT_MAX; - static const int bits = CHAR_BIT * (sizeof(short) / sizeof(char)); - static const bool is_signed = etl::is_signed::value; + static ETL_CONSTANT short min = SHRT_MIN; + static ETL_CONSTANT short max = SHRT_MAX; + static ETL_CONSTANT int bits = CHAR_BIT * (sizeof(short) / sizeof(char)); + static ETL_CONSTANT bool is_signed = etl::is_signed::value; }; //*************************************************************************** @@ -119,10 +119,10 @@ namespace etl template <> struct integral_limits { - static const unsigned short min = 0; - static const unsigned short max = USHRT_MAX; - static const int bits = CHAR_BIT * (sizeof(unsigned short) / sizeof(char)); - static const bool is_signed = etl::is_signed::value; + static ETL_CONSTANT unsigned short min = 0; + static ETL_CONSTANT unsigned short max = USHRT_MAX; + static ETL_CONSTANT int bits = CHAR_BIT * (sizeof(unsigned short) / sizeof(char)); + static ETL_CONSTANT bool is_signed = etl::is_signed::value; }; //*************************************************************************** @@ -131,10 +131,10 @@ namespace etl template <> struct integral_limits { - static const int min = INT_MIN; - static const int max = INT_MAX; - static const int bits = CHAR_BIT * (sizeof(int) / sizeof(char)); - static const bool is_signed = etl::is_signed::value; + static ETL_CONSTANT int min = INT_MIN; + static ETL_CONSTANT int max = INT_MAX; + static ETL_CONSTANT int bits = CHAR_BIT * (sizeof(int) / sizeof(char)); + static ETL_CONSTANT bool is_signed = etl::is_signed::value; }; //*************************************************************************** @@ -143,10 +143,10 @@ namespace etl template <> struct integral_limits { - static const unsigned int min = 0; - static const unsigned int max = UINT_MAX; - static const int bits = CHAR_BIT * (sizeof(unsigned int) / sizeof(char)); - static const bool is_signed = etl::is_signed::value; + static ETL_CONSTANT unsigned int min = 0; + static ETL_CONSTANT unsigned int max = UINT_MAX; + static ETL_CONSTANT int bits = CHAR_BIT * (sizeof(unsigned int) / sizeof(char)); + static ETL_CONSTANT bool is_signed = etl::is_signed::value; }; //*************************************************************************** @@ -155,10 +155,10 @@ namespace etl template <> struct integral_limits { - static const long min = LONG_MIN; - static const long max = LONG_MAX; - static const int bits = CHAR_BIT * (sizeof(long) / sizeof(char)); - static const bool is_signed = etl::is_signed::value; + static ETL_CONSTANT long min = LONG_MIN; + static ETL_CONSTANT long max = LONG_MAX; + static ETL_CONSTANT int bits = CHAR_BIT * (sizeof(long) / sizeof(char)); + static ETL_CONSTANT bool is_signed = etl::is_signed::value; }; //*************************************************************************** @@ -167,10 +167,10 @@ namespace etl template <> struct integral_limits { - static const unsigned long min = 0; - static const unsigned long max = ULONG_MAX; - static const int bits = CHAR_BIT * (sizeof(unsigned long) / sizeof(char)); - static const bool is_signed = etl::is_signed::value; + static ETL_CONSTANT unsigned long min = 0; + static ETL_CONSTANT unsigned long max = ULONG_MAX; + static ETL_CONSTANT int bits = CHAR_BIT * (sizeof(unsigned long) / sizeof(char)); + static ETL_CONSTANT bool is_signed = etl::is_signed::value; }; #ifndef LLONG_MAX @@ -191,10 +191,10 @@ namespace etl template <> struct integral_limits { - static const long long min = LLONG_MIN; - static const long long max = LLONG_MAX; - static const int bits = CHAR_BIT * (sizeof(long long) / sizeof(char)); - static const bool is_signed = etl::is_signed::value; + static ETL_CONSTANT long long min = LLONG_MIN; + static ETL_CONSTANT long long max = LLONG_MAX; + static ETL_CONSTANT int bits = CHAR_BIT * (sizeof(long long) / sizeof(char)); + static ETL_CONSTANT bool is_signed = etl::is_signed::value; }; //*************************************************************************** @@ -203,10 +203,10 @@ namespace etl template <> struct integral_limits { - static const unsigned long long min = 0; - static const unsigned long long max = ULLONG_MAX; - static const int bits = CHAR_BIT * (sizeof(unsigned long long) / sizeof(char)); - static const bool is_signed = etl::is_signed::value; + static ETL_CONSTANT unsigned long long min = 0; + static ETL_CONSTANT unsigned long long max = ULLONG_MAX; + static ETL_CONSTANT int bits = CHAR_BIT * (sizeof(unsigned long long) / sizeof(char)); + static ETL_CONSTANT bool is_signed = etl::is_signed::value; }; } diff --git a/include/etl/list.h b/include/etl/list.h index e0411bbb..37ca40f1 100644 --- a/include/etl/list.h +++ b/include/etl/list.h @@ -2029,7 +2029,7 @@ namespace etl ETL_STATIC_ASSERT((MAX_SIZE_ > 0U), "Zero capacity etl::list is not valid"); - static const size_t MAX_SIZE = MAX_SIZE_; + static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_; public: diff --git a/include/etl/map.h b/include/etl/map.h index c6eca8cb..31777e18 100644 --- a/include/etl/map.h +++ b/include/etl/map.h @@ -2175,7 +2175,7 @@ namespace etl { public: - static const size_t MAX_SIZE = MAX_SIZE_; + static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_; //************************************************************************* /// Default constructor. diff --git a/include/etl/multimap.h b/include/etl/multimap.h index 427e7b25..74caef83 100644 --- a/include/etl/multimap.h +++ b/include/etl/multimap.h @@ -2037,7 +2037,7 @@ namespace etl { public: - static const size_t MAX_SIZE = MAX_SIZE_; + static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_; //************************************************************************* /// Default constructor. diff --git a/include/etl/multiset.h b/include/etl/multiset.h index c00d2c12..44666f9f 100644 --- a/include/etl/multiset.h +++ b/include/etl/multiset.h @@ -2021,7 +2021,7 @@ namespace etl { public: - static const size_t MAX_SIZE = MAX_SIZE_; + static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_; //************************************************************************* /// Default constructor. diff --git a/include/etl/murmur3.h b/include/etl/murmur3.h index 9862d7bf..74894707 100644 --- a/include/etl/murmur3.h +++ b/include/etl/murmur3.h @@ -226,13 +226,13 @@ namespace etl value_type hash; value_type seed; - static const uint8_t FULL_BLOCK = 4; - static const value_type CONSTANT1 = 0xCC9E2D51; - static const value_type CONSTANT2 = 0x1B873593; - static const value_type SHIFT1 = 15; - static const value_type SHIFT2 = 13; - static const value_type MULTIPLY = 5; - static const value_type ADD = 0xE6546B64; + static ETL_CONSTANT uint8_t FULL_BLOCK = 4; + static ETL_CONSTANT value_type CONSTANT1 = 0xCC9E2D51; + static ETL_CONSTANT value_type CONSTANT2 = 0x1B873593; + static ETL_CONSTANT value_type SHIFT1 = 15; + static ETL_CONSTANT value_type SHIFT2 = 13; + static ETL_CONSTANT value_type MULTIPLY = 5; + static ETL_CONSTANT value_type ADD = 0xE6546B64; }; } diff --git a/include/etl/pearson.h b/include/etl/pearson.h index d7379c78..045b7e02 100644 --- a/include/etl/pearson.h +++ b/include/etl/pearson.h @@ -116,7 +116,7 @@ namespace etl //************************************************************************* void add(uint8_t value_) { - static const uint8_t PEARSON_LOOKUP[] = + static ETL_CONSTANT uint8_t PEARSON_LOOKUP[] = { 228, 39, 61, 95, 227, 187, 0, 197, 31, 189, 161, 222, 34, 15, 221, 246, 19, 234, 6, 50, 113, 3, 91, 63, 77, 245, 144, 2, 183, 196, 25, 226, diff --git a/include/etl/priority_queue.h b/include/etl/priority_queue.h index 49db2f1c..5c0cd0cb 100644 --- a/include/etl/priority_queue.h +++ b/include/etl/priority_queue.h @@ -419,7 +419,7 @@ namespace etl typedef typename TContainer::size_type size_type; - static const size_type MAX_SIZE = size_type(SIZE); + static ETL_CONSTANT size_type MAX_SIZE = size_type(SIZE); //************************************************************************* /// Default constructor. diff --git a/include/etl/queue.h b/include/etl/queue.h index ef2b5c67..4dd12d88 100644 --- a/include/etl/queue.h +++ b/include/etl/queue.h @@ -588,7 +588,7 @@ namespace etl ETL_STATIC_ASSERT((SIZE <= etl::integral_limits::max), "Size too large for memory model"); - static const size_type MAX_SIZE = size_type(SIZE); + static ETL_CONSTANT size_type MAX_SIZE = size_type(SIZE); //************************************************************************* /// Default constructor. diff --git a/include/etl/queue_mpmc_mutex.h b/include/etl/queue_mpmc_mutex.h index 4b6f1722..0d29b28c 100644 --- a/include/etl/queue_mpmc_mutex.h +++ b/include/etl/queue_mpmc_mutex.h @@ -601,7 +601,7 @@ namespace etl ETL_STATIC_ASSERT((SIZE <= etl::integral_limits::max), "Size too large for memory model"); - static const size_type MAX_SIZE = size_type(SIZE); + static ETL_CONSTANT size_type MAX_SIZE = size_type(SIZE); //************************************************************************* /// Default constructor. diff --git a/include/etl/queue_spsc_atomic.h b/include/etl/queue_spsc_atomic.h index bf350c2a..1d14226c 100644 --- a/include/etl/queue_spsc_atomic.h +++ b/include/etl/queue_spsc_atomic.h @@ -474,13 +474,13 @@ namespace etl private: - static const size_type RESERVED_SIZE = size_type(SIZE + 1); + static ETL_CONSTANT size_type RESERVED_SIZE = size_type(SIZE + 1); public: ETL_STATIC_ASSERT((SIZE <= (etl::integral_limits::max - 1)), "Size too large for memory model"); - static const size_type MAX_SIZE = size_type(SIZE); + static ETL_CONSTANT size_type MAX_SIZE = size_type(SIZE); //************************************************************************* /// Default constructor. diff --git a/include/etl/queue_spsc_isr.h b/include/etl/queue_spsc_isr.h index bee8aacf..0eed51ca 100644 --- a/include/etl/queue_spsc_isr.h +++ b/include/etl/queue_spsc_isr.h @@ -706,7 +706,7 @@ namespace etl ETL_STATIC_ASSERT((SIZE <= etl::integral_limits::max), "Size too large for memory model"); - static const size_type MAX_SIZE = size_type(SIZE); + static ETL_CONSTANT size_type MAX_SIZE = size_type(SIZE); //************************************************************************* /// Default constructor. diff --git a/include/etl/queue_spsc_locked.h b/include/etl/queue_spsc_locked.h index 9e4e6b42..60d4cc54 100644 --- a/include/etl/queue_spsc_locked.h +++ b/include/etl/queue_spsc_locked.h @@ -763,7 +763,7 @@ namespace etl ETL_STATIC_ASSERT((SIZE <= etl::integral_limits::max), "Size too large for memory model"); - static const size_type MAX_SIZE = size_type(SIZE); + static ETL_CONSTANT size_type MAX_SIZE = size_type(SIZE); //************************************************************************* /// Default constructor. diff --git a/include/etl/random.h b/include/etl/random.h index a2d8cc60..a66890f8 100644 --- a/include/etl/random.h +++ b/include/etl/random.h @@ -218,8 +218,8 @@ namespace etl private: - static const uint32_t a = 40014; - static const uint32_t m = 2147483563; + static ETL_CONSTANT uint32_t a = 40014; + static ETL_CONSTANT uint32_t m = 2147483563; uint32_t value; }; @@ -271,7 +271,7 @@ namespace etl //*************************************************************************** uint32_t operator()() { - static const uint32_t m = ((m1 > m2) ? m1 : m2); + static ETL_CONSTANT uint32_t m = ((m1 > m2) ? m1 : m2); value1 = (a1 * value1) % m1; value2 = (a2 * value2) % m2; @@ -294,11 +294,11 @@ namespace etl private: - static const uint32_t a1 = 40014; - static const uint32_t m1 = 2147483563; + static ETL_CONSTANT uint32_t a1 = 40014; + static ETL_CONSTANT uint32_t m1 = 2147483563; - static const uint32_t a2 = 40692; - static const uint32_t m2 = 2147483399; + static ETL_CONSTANT uint32_t a2 = 40692; + static ETL_CONSTANT uint32_t m2 = 2147483399; uint32_t value1; uint32_t value2; @@ -350,7 +350,7 @@ namespace etl //*************************************************************************** uint32_t operator()() { - static const uint32_t polynomial = 0x80200003; + static ETL_CONSTANT uint32_t polynomial = 0x80200003; value >>= 1; @@ -514,8 +514,8 @@ namespace etl private: - static const uint64_t multiplier = 6364136223846793005ULL; - static const uint64_t increment = 1ULL; + static ETL_CONSTANT uint64_t multiplier = 6364136223846793005ULL; + static ETL_CONSTANT uint64_t increment = 1ULL; uint64_t value; }; diff --git a/include/etl/reference_counted_message_pool.h b/include/etl/reference_counted_message_pool.h index ce612c8a..ca17cc9a 100644 --- a/include/etl/reference_counted_message_pool.h +++ b/include/etl/reference_counted_message_pool.h @@ -223,7 +223,7 @@ namespace etl ETL_STATIC_ASSERT((etl::is_base_of::value), "TMessage7 not derived from etl::imessage"); ETL_STATIC_ASSERT((etl::is_base_of::value), "TMessage8 not derived from etl::imessage"); - static const size_t max_size = etl::largest, + static ETL_CONSTANT size_t max_size = etl::largest, etl::reference_counted_message, etl::reference_counted_message, etl::reference_counted_message, @@ -233,7 +233,7 @@ namespace etl etl::reference_counted_message >::size; - static const size_t max_alignment = etl::largest, + static ETL_CONSTANT size_t max_alignment = etl::largest, etl::reference_counted_message, etl::reference_counted_message, etl::reference_counted_message, diff --git a/include/etl/reference_flat_map.h b/include/etl/reference_flat_map.h index c23217a3..7974234f 100644 --- a/include/etl/reference_flat_map.h +++ b/include/etl/reference_flat_map.h @@ -923,7 +923,7 @@ namespace etl { public: - static const size_t MAX_SIZE = MAX_SIZE_; + static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_; //************************************************************************* /// Constructor. diff --git a/include/etl/reference_flat_multimap.h b/include/etl/reference_flat_multimap.h index 7ec9ee23..2151a73b 100644 --- a/include/etl/reference_flat_multimap.h +++ b/include/etl/reference_flat_multimap.h @@ -826,7 +826,7 @@ namespace etl { public: - static const size_t MAX_SIZE = MAX_SIZE_; + static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_; //************************************************************************* /// Constructor. diff --git a/include/etl/reference_flat_multiset.h b/include/etl/reference_flat_multiset.h index 1df13752..3bf3e348 100644 --- a/include/etl/reference_flat_multiset.h +++ b/include/etl/reference_flat_multiset.h @@ -807,7 +807,7 @@ namespace etl { public: - static const size_t MAX_SIZE = MAX_SIZE_; + static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_; //************************************************************************* /// Constructor. diff --git a/include/etl/reference_flat_set.h b/include/etl/reference_flat_set.h index d7552d66..d574694d 100644 --- a/include/etl/reference_flat_set.h +++ b/include/etl/reference_flat_set.h @@ -791,7 +791,7 @@ namespace etl { public: - static const size_t MAX_SIZE = MAX_SIZE_; + static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_; //************************************************************************* /// Constructor. diff --git a/include/etl/set.h b/include/etl/set.h index dee8d6e9..f1b9895e 100644 --- a/include/etl/set.h +++ b/include/etl/set.h @@ -2101,7 +2101,7 @@ namespace etl { public: - static const size_t MAX_SIZE = MAX_SIZE_; + static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_; //************************************************************************* /// Default constructor. diff --git a/include/etl/smallest.h b/include/etl/smallest.h index fbd953f7..5a694c42 100644 --- a/include/etl/smallest.h +++ b/include/etl/smallest.h @@ -290,9 +290,9 @@ namespace etl private: // Determines the index of the best unsigned type for the required number of bits. - static const int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) + - ((NBITS > 16) ? 1 : 0) + - ((NBITS > 32) ? 1 : 0); + static ETL_CONSTANT int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) + + ((NBITS > 16) ? 1 : 0) + + ((NBITS > 32) ? 1 : 0); public: @@ -316,9 +316,9 @@ namespace etl private: // Determines the index of the best unsigned type for the required number of bits. - static const int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) + - ((NBITS > 16) ? 1 : 0) + - ((NBITS > 32) ? 1 : 0); + static ETL_CONSTANT int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) + + ((NBITS > 16) ? 1 : 0) + + ((NBITS > 32) ? 1 : 0); public: @@ -342,9 +342,9 @@ namespace etl private: // Determines the index of the best unsigned type for the required value. - static const int TYPE_INDEX = ((VALUE > UINT_LEAST8_MAX) ? 1 : 0) + - ((VALUE > UINT16_MAX) ? 1 : 0) + - ((VALUE > UINT32_MAX) ? 1 : 0); + static ETL_CONSTANT int TYPE_INDEX = ((VALUE > UINT_LEAST8_MAX) ? 1 : 0) + + ((VALUE > UINT16_MAX) ? 1 : 0) + + ((VALUE > UINT32_MAX) ? 1 : 0); public: @@ -368,9 +368,9 @@ namespace etl private: // Determines the index of the best signed type for the required value. - static const int TYPE_INDEX = (((VALUE > intmax_t(INT_LEAST8_MAX)) || (VALUE < intmax_t(INT_LEAST8_MIN))) ? 1 : 0) + - (((VALUE > intmax_t(INT16_MAX)) || (VALUE < intmax_t(INT16_MIN))) ? 1 : 0) + - (((VALUE > intmax_t(INT32_MAX)) || (VALUE < intmax_t(INT32_MIN))) ? 1 : 0); + static ETL_CONSTANT int TYPE_INDEX = (((VALUE > intmax_t(INT_LEAST8_MAX)) || (VALUE < intmax_t(INT_LEAST8_MIN))) ? 1 : 0) + + (((VALUE > intmax_t(INT16_MAX)) || (VALUE < intmax_t(INT16_MIN))) ? 1 : 0) + + (((VALUE > intmax_t(INT32_MAX)) || (VALUE < intmax_t(INT32_MIN))) ? 1 : 0); public: diff --git a/include/etl/stack.h b/include/etl/stack.h index 2437494b..0b2324f3 100644 --- a/include/etl/stack.h +++ b/include/etl/stack.h @@ -529,7 +529,7 @@ namespace etl { public: - static const size_t MAX_SIZE = SIZE; + static ETL_CONSTANT size_t MAX_SIZE = SIZE; //************************************************************************* /// Default constructor. diff --git a/include/etl/string.h b/include/etl/string.h index bbdc13ca..85d892b2 100644 --- a/include/etl/string.h +++ b/include/etl/string.h @@ -63,7 +63,7 @@ namespace etl typedef istring::value_type value_type; - static const size_t MAX_SIZE = MAX_SIZE_; + static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_; //************************************************************************* /// Constructor. diff --git a/include/etl/unordered_map.h b/include/etl/unordered_map.h index 14ac0fcc..fc1ae499 100644 --- a/include/etl/unordered_map.h +++ b/include/etl/unordered_map.h @@ -1540,8 +1540,8 @@ namespace etl public: - static const size_t MAX_SIZE = MAX_SIZE_; - static const size_t MAX_BUCKETS = MAX_BUCKETS_; + static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_; + static ETL_CONSTANT size_t MAX_BUCKETS = MAX_BUCKETS_; //************************************************************************* /// Default constructor. diff --git a/include/etl/unordered_multimap.h b/include/etl/unordered_multimap.h index d9ff2b0a..21a3b5e1 100644 --- a/include/etl/unordered_multimap.h +++ b/include/etl/unordered_multimap.h @@ -1446,8 +1446,8 @@ namespace etl public: - static const size_t MAX_SIZE = MAX_SIZE_; - static const size_t MAX_BUCKETS = MAX_BUCKETS_; + static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_; + static ETL_CONSTANT size_t MAX_BUCKETS = MAX_BUCKETS_; //************************************************************************* /// Default constructor. diff --git a/include/etl/unordered_multiset.h b/include/etl/unordered_multiset.h index 5ed84b7c..95ee19b5 100644 --- a/include/etl/unordered_multiset.h +++ b/include/etl/unordered_multiset.h @@ -1430,8 +1430,8 @@ namespace etl public: - static const size_t MAX_SIZE = MAX_SIZE_; - static const size_t MAX_BUCKETS = MAX_BUCKETS_; + static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_; + static ETL_CONSTANT size_t MAX_BUCKETS = MAX_BUCKETS_; //************************************************************************* diff --git a/include/etl/unordered_set.h b/include/etl/unordered_set.h index 5b89bee2..69a02728 100644 --- a/include/etl/unordered_set.h +++ b/include/etl/unordered_set.h @@ -1430,8 +1430,8 @@ namespace etl public: - static const size_t MAX_SIZE = MAX_SIZE_; - static const size_t MAX_BUCKETS = MAX_BUCKETS_; + static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_; + static ETL_CONSTANT size_t MAX_BUCKETS = MAX_BUCKETS_; //************************************************************************* /// Default constructor.