3232
3333#include " ../common/gdsassert.h"
3434
35- const SINT64 BOF_NUMBER = QUADCONST(-1 );
35+ inline constexpr SINT64 BOF_NUMBER = QUADCONST(-1 );
3636
3737// This class is to be used everywhere you may need to handle record numbers. We
3838// deliberately not define implicit conversions to and from integer to allow
@@ -76,12 +76,12 @@ class RecordNumber
7676#endif
7777
7878 public:
79- ULONG& bid_temp_id ()
79+ ULONG& bid_temp_id () noexcept
8080 {
8181 return bid_number;
8282 }
8383
84- ULONG bid_temp_id () const
84+ ULONG bid_temp_id () const noexcept
8585 {
8686 return bid_number;
8787 }
@@ -90,7 +90,7 @@ class RecordNumber
9090 // BLOB ID is stored in database thus we do encode large record numbers
9191 // in a manner which preserves backward compatibility with older ODS.
9292 // The same applies to bid_decode routine below.
93- inline void bid_encode (SINT64 value)
93+ inline void bid_encode (SINT64 value) noexcept
9494 {
9595 // Use explicit casts to suppress 64-bit truncation warnings
9696 // Store lower 32 bits of number
@@ -99,76 +99,76 @@ class RecordNumber
9999 bid_number_up = static_cast <UCHAR>(value >> 32 );
100100 }
101101
102- inline SINT64 bid_decode () const
102+ inline SINT64 bid_decode () const noexcept
103103 {
104104 return bid_number + (static_cast <FB_UINT64>(bid_number_up) << 32 );
105105 }
106106 };
107107
108108 // Default constructor.
109- inline RecordNumber () : value(0 ), valid(false ) {}
109+ inline RecordNumber () noexcept : value(0 ), valid(false ) {}
110110
111111 // Copy constructor
112- inline RecordNumber (const RecordNumber& from) : value(from.value), valid(from.valid) {}
112+ inline RecordNumber (const RecordNumber& from) noexcept : value(from.value), valid(from.valid) {}
113113
114114 // Explicit constructor from 64-bit record number value
115- inline explicit RecordNumber (SINT64 number) : value(number), valid(true ) {}
115+ inline explicit RecordNumber (SINT64 number) noexcept : value(number), valid(true ) {}
116116
117117 // Assignment operator
118- inline RecordNumber& operator =(const RecordNumber& from)
118+ inline RecordNumber& operator =(const RecordNumber& from) noexcept
119119 {
120120 value = from.value ;
121121 valid = from.valid ;
122122 return *this ;
123123 }
124124
125- inline bool operator ==(const RecordNumber& other) const
125+ inline bool operator ==(const RecordNumber& other) const noexcept
126126 {
127127 return value == other.value ;
128128 }
129129
130- inline bool operator !=(const RecordNumber& other) const
130+ inline bool operator !=(const RecordNumber& other) const noexcept
131131 {
132132 return value != other.value ;
133133 }
134134
135- inline bool operator > (const RecordNumber& other) const
135+ inline bool operator > (const RecordNumber& other) const noexcept
136136 {
137137 return value > other.value ;
138138 }
139139
140- inline bool operator < (const RecordNumber& other) const
140+ inline bool operator < (const RecordNumber& other) const noexcept
141141 {
142142 return value < other.value ;
143143 }
144144
145- inline bool operator >= (const RecordNumber& other) const
145+ inline bool operator >= (const RecordNumber& other) const noexcept
146146 {
147147 return value >= other.value ;
148148 }
149149
150- inline bool operator <= (const RecordNumber& other) const
150+ inline bool operator <= (const RecordNumber& other) const noexcept
151151 {
152152 return value <= other.value ;
153153 }
154154
155- inline void decrement () { value--; }
155+ inline void decrement () noexcept { value--; }
156156
157- inline void increment () { value++; }
157+ inline void increment () noexcept { value++; }
158158
159- inline SINT64 getValue () const { return value; }
159+ inline SINT64 getValue () const noexcept { return value; }
160160
161- inline void setValue (SINT64 avalue) { value = avalue; }
161+ inline void setValue (SINT64 avalue) noexcept { value = avalue; }
162162
163- bool isBof () const { return value == BOF_NUMBER; }
163+ bool isBof () const noexcept { return value == BOF_NUMBER; }
164164
165- bool isValid () const { return valid; }
165+ bool isValid () const noexcept { return valid; }
166166
167167 inline void decompose (USHORT records_per_page, // ~400 (8k page)
168168 USHORT data_pages_per_pointer_page, // ~2000 (8k page)
169169 USHORT& line,
170170 USHORT& slot,
171- ULONG& pp_sequence) const
171+ ULONG& pp_sequence) const noexcept
172172 {
173173 // Use explicit casts to suppress 64-bit truncation warnings
174174 line = static_cast <USHORT>(value % records_per_page);
@@ -181,23 +181,23 @@ class RecordNumber
181181 USHORT data_pages_per_pointer_page, // ~2000 (8k page)
182182 USHORT line,
183183 USHORT slot,
184- ULONG pp_sequence)
184+ ULONG pp_sequence) noexcept
185185 {
186186 value = (((SINT64) pp_sequence) * data_pages_per_pointer_page + slot) * records_per_page + line;
187187 }
188188
189189 // Handle encoding of record number for RDB$DB_KEY and BLOB ID structure.
190- inline void bid_encode (Packed* recno) const
190+ inline void bid_encode (Packed* recno) const noexcept
191191 {
192192 recno->bid_encode (value);
193193 }
194194
195- inline void bid_decode (const Packed* recno)
195+ inline void bid_decode (const Packed* recno) noexcept
196196 {
197197 value = recno->bid_decode ();
198198 }
199199
200- inline void setValid (bool to_value)
200+ inline void setValid (bool to_value) noexcept
201201 {
202202 valid = to_value;
203203 }
@@ -237,59 +237,59 @@ struct bid
237237 bid_quad_struct bid_quad;
238238 };
239239
240- ULONG& bid_temp_id ()
240+ ULONG& bid_temp_id () noexcept
241241 {
242242 return bid_internal.bid_temp_id ();
243243 }
244244
245- ULONG bid_temp_id () const
245+ ULONG bid_temp_id () const noexcept
246246 {
247247 return bid_internal.bid_temp_id ();
248248 }
249249
250- bool isEmpty () const
250+ bool isEmpty () const noexcept
251251 {
252252 return bid_quad.bid_quad_high == 0 && bid_quad.bid_quad_low == 0 ;
253253 }
254254
255- void clear ()
255+ void clear () noexcept
256256 {
257257 bid_quad.bid_quad_high = 0 ;
258258 bid_quad.bid_quad_low = 0 ;
259259 }
260260
261- void set_temporary (ULONG temp_id)
261+ void set_temporary (ULONG temp_id) noexcept
262262 {
263263 clear ();
264264 bid_temp_id () = temp_id;
265265 }
266266
267- void set_permanent (USHORT relation_id, RecordNumber num)
267+ void set_permanent (USHORT relation_id, RecordNumber num) noexcept
268268 {
269269 clear ();
270270 bid_internal.bid_relation_id = relation_id;
271271 num.bid_encode (&bid_internal);
272272 }
273273
274- RecordNumber get_permanent_number () const
274+ RecordNumber get_permanent_number () const noexcept
275275 {
276276 RecordNumber temp;
277277 temp.bid_decode (&bid_internal);
278278 return temp;
279279 }
280280
281- operator ISC_QUAD () const
281+ operator ISC_QUAD () const noexcept
282282 {
283- return {ISC_LONG (bid_quad.bid_quad_high ), bid_quad.bid_quad_low };
283+ return { static_cast < ISC_LONG> (bid_quad.bid_quad_high ), bid_quad.bid_quad_low };
284284 }
285285
286- bool operator == (const bid& other) const
286+ bool operator == (const bid& other) const noexcept
287287 {
288288 return bid_quad.bid_quad_high == other.bid_quad .bid_quad_high &&
289289 bid_quad.bid_quad_low == other.bid_quad .bid_quad_low ;
290290 }
291291
292- bool operator > (const bid& other) const
292+ bool operator > (const bid& other) const noexcept
293293 {
294294 return bid_quad.bid_quad_high > other.bid_quad .bid_quad_high ||
295295 (bid_quad.bid_quad_high == other.bid_quad .bid_quad_high &&
0 commit comments