@@ -66,7 +66,7 @@ struct DecFloatConstant
66
66
// #define FB_DECLOAT_CONST(x) { STRINGIZE(x), x }
67
67
#define FB_DECLOAT_CONST (x ) { #x, x }
68
68
69
- const DecFloatConstant FB_DEC_RoundModes[] = {
69
+ inline constexpr DecFloatConstant FB_DEC_RoundModes[] = {
70
70
FB_DECLOAT_CONST (DEC_ROUND_CEILING),
71
71
FB_DECLOAT_CONST (DEC_ROUND_UP),
72
72
FB_DECLOAT_CONST (DEC_ROUND_HALF_UP),
@@ -80,9 +80,9 @@ const DecFloatConstant FB_DEC_RoundModes[] = {
80
80
81
81
// DEC_ROUND_
82
82
// 0123456789
83
- const unsigned FB_DEC_RMODE_OFFSET = 10 ;
83
+ inline constexpr unsigned FB_DEC_RMODE_OFFSET = 10 ;
84
84
85
- const DecFloatConstant FB_DEC_IeeeTraps[] = {
85
+ inline constexpr DecFloatConstant FB_DEC_IeeeTraps[] = {
86
86
FB_DECLOAT_CONST (DEC_IEEE_754_Division_by_zero),
87
87
FB_DECLOAT_CONST (DEC_IEEE_754_Inexact),
88
88
FB_DECLOAT_CONST (DEC_IEEE_754_Invalid_operation),
@@ -93,18 +93,18 @@ const DecFloatConstant FB_DEC_IeeeTraps[] = {
93
93
94
94
// DEC_IEEE_754_
95
95
// 0123456789012
96
- const unsigned FB_DEC_TRAPS_OFFSET = 13 ;
96
+ inline constexpr unsigned FB_DEC_TRAPS_OFFSET = 13 ;
97
97
98
98
#undef FB_DECLOAT_CONST
99
99
100
- static const USHORT FB_DEC_Errors =
100
+ static inline constexpr USHORT FB_DEC_Errors =
101
101
DEC_IEEE_754_Division_by_zero |
102
102
DEC_IEEE_754_Invalid_operation |
103
103
DEC_IEEE_754_Overflow;
104
104
105
105
struct DecimalStatus
106
106
{
107
- DecimalStatus (USHORT exc)
107
+ DecimalStatus (USHORT exc) noexcept
108
108
: decExtFlag(exc),
109
109
roundingMode (DEC_ROUND_HALF_UP)
110
110
{}
@@ -127,18 +127,18 @@ struct NumericBinding
127
127
NUM_INT64
128
128
};
129
129
130
- NumericBinding ()
130
+ NumericBinding () noexcept
131
131
: bind(NUM_NATIVE),
132
132
numScale (0 )
133
133
{}
134
134
135
- NumericBinding (Bind aBind, SCHAR aNumScale = 0 )
135
+ NumericBinding (Bind aBind, SCHAR aNumScale = 0 ) noexcept
136
136
: bind(aBind),
137
137
numScale(aNumScale)
138
138
{}
139
139
140
140
static const NumericBinding DEFAULT;
141
- static const SCHAR MAX_SCALE = 18 ;
141
+ static inline constexpr SCHAR MAX_SCALE = 18 ;
142
142
143
143
Bind bind;
144
144
SCHAR numScale;
@@ -175,7 +175,7 @@ class Decimal64
175
175
bool isNan () const ;
176
176
int sign () const ;
177
177
178
- static ULONG getKeyLength ()
178
+ static constexpr ULONG getKeyLength () noexcept
179
179
{
180
180
return sizeof (Decimal64) + sizeof (ULONG);
181
181
}
@@ -251,15 +251,15 @@ class Decimal128
251
251
bool isNan () const ;
252
252
int sign () const ;
253
253
254
- static ULONG getKeyLength ()
254
+ static constexpr ULONG getKeyLength () noexcept
255
255
{
256
256
return sizeof (Decimal128) + sizeof (ULONG);
257
257
}
258
258
259
259
void makeKey (ULONG* key) const ;
260
260
void grabKey (ULONG* key);
261
261
262
- static ULONG getIndexKeyLength ()
262
+ static constexpr ULONG getIndexKeyLength () noexcept
263
263
{
264
264
return 17 ;
265
265
}
@@ -313,8 +313,8 @@ class CDecimal128 : public Decimal128
313
313
static_assert (sizeof (Decimal64) % sizeof(ULONG) == 0, "Decimal64 size mismatch");
314
314
static_assert (sizeof (Decimal128) % sizeof(ULONG) == 0, "Decimal128 size mismatch");
315
315
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
318
318
319
319
} // namespace Firebird
320
320
0 commit comments