@@ -66,7 +66,7 @@ struct DecFloatConstant
6666// #define FB_DECLOAT_CONST(x) { STRINGIZE(x), x }
6767#define FB_DECLOAT_CONST (x ) { #x, x }
6868
69- const DecFloatConstant FB_DEC_RoundModes[] = {
69+ inline constexpr DecFloatConstant FB_DEC_RoundModes[] = {
7070 FB_DECLOAT_CONST (DEC_ROUND_CEILING),
7171 FB_DECLOAT_CONST (DEC_ROUND_UP),
7272 FB_DECLOAT_CONST (DEC_ROUND_HALF_UP),
@@ -80,9 +80,9 @@ const DecFloatConstant FB_DEC_RoundModes[] = {
8080
8181// DEC_ROUND_
8282// 0123456789
83- const unsigned FB_DEC_RMODE_OFFSET = 10 ;
83+ inline constexpr unsigned FB_DEC_RMODE_OFFSET = 10 ;
8484
85- const DecFloatConstant FB_DEC_IeeeTraps[] = {
85+ inline constexpr DecFloatConstant FB_DEC_IeeeTraps[] = {
8686 FB_DECLOAT_CONST (DEC_IEEE_754_Division_by_zero),
8787 FB_DECLOAT_CONST (DEC_IEEE_754_Inexact),
8888 FB_DECLOAT_CONST (DEC_IEEE_754_Invalid_operation),
@@ -93,18 +93,18 @@ const DecFloatConstant FB_DEC_IeeeTraps[] = {
9393
9494// DEC_IEEE_754_
9595// 0123456789012
96- const unsigned FB_DEC_TRAPS_OFFSET = 13 ;
96+ inline constexpr unsigned FB_DEC_TRAPS_OFFSET = 13 ;
9797
9898#undef FB_DECLOAT_CONST
9999
100- static const USHORT FB_DEC_Errors =
100+ static inline constexpr USHORT FB_DEC_Errors =
101101 DEC_IEEE_754_Division_by_zero |
102102 DEC_IEEE_754_Invalid_operation |
103103 DEC_IEEE_754_Overflow;
104104
105105struct DecimalStatus
106106{
107- DecimalStatus (USHORT exc)
107+ DecimalStatus (USHORT exc) noexcept
108108 : decExtFlag(exc),
109109 roundingMode (DEC_ROUND_HALF_UP)
110110 {}
@@ -127,18 +127,18 @@ struct NumericBinding
127127 NUM_INT64
128128 };
129129
130- NumericBinding ()
130+ NumericBinding () noexcept
131131 : bind(NUM_NATIVE),
132132 numScale (0 )
133133 {}
134134
135- NumericBinding (Bind aBind, SCHAR aNumScale = 0 )
135+ NumericBinding (Bind aBind, SCHAR aNumScale = 0 ) noexcept
136136 : bind(aBind),
137137 numScale(aNumScale)
138138 {}
139139
140140 static const NumericBinding DEFAULT;
141- static const SCHAR MAX_SCALE = 18 ;
141+ static inline constexpr SCHAR MAX_SCALE = 18 ;
142142
143143 Bind bind;
144144 SCHAR numScale;
@@ -175,7 +175,7 @@ class Decimal64
175175 bool isNan () const ;
176176 int sign () const ;
177177
178- static ULONG getKeyLength ()
178+ static constexpr ULONG getKeyLength () noexcept
179179 {
180180 return sizeof (Decimal64) + sizeof (ULONG);
181181 }
@@ -251,15 +251,15 @@ class Decimal128
251251 bool isNan () const ;
252252 int sign () const ;
253253
254- static ULONG getKeyLength ()
254+ static constexpr ULONG getKeyLength () noexcept
255255 {
256256 return sizeof (Decimal128) + sizeof (ULONG);
257257 }
258258
259259 void makeKey (ULONG* key) const ;
260260 void grabKey (ULONG* key);
261261
262- static ULONG getIndexKeyLength ()
262+ static constexpr ULONG getIndexKeyLength () noexcept
263263 {
264264 return 17 ;
265265 }
@@ -313,8 +313,8 @@ class CDecimal128 : public Decimal128
313313static_assert (sizeof (Decimal64) % sizeof (ULONG) == 0 , " Decimal64 size mismatch" );
314314static_assert (sizeof (Decimal128) % sizeof (ULONG) == 0 , " Decimal128 size mismatch" );
315315
316- static const size_t MAX_DEC_LONGS = MAX(sizeof (Decimal64), sizeof (Decimal128)) >> SHIFTLONG;
317- static const size_t MAX_DEC_KEY_LONGS = MAX_DEC_LONGS + 1 ; // key is one longword bigger
316+ static inline constexpr size_t MAX_DEC_LONGS = MAX(sizeof (Decimal64), sizeof (Decimal128)) >> SHIFTLONG;
317+ static inline constexpr size_t MAX_DEC_KEY_LONGS = MAX_DEC_LONGS + 1 ; // key is one longword bigger
318318
319319} // namespace Firebird
320320
0 commit comments