@@ -210,115 +210,115 @@ constexpr static float powers_of_ten_float[] = {1e0, 1e1, 1e2, 1e3, 1e4, 1e5,
210
210
1e6 , 1e7 , 1e8 , 1e9 , 1e10 };
211
211
212
212
template <typename T> struct binary_format {
213
- static constexpr int mantissa_explicit_bits ();
214
- static constexpr int minimum_exponent ();
215
- static constexpr int infinite_power ();
216
- static constexpr int sign_index ();
217
- static constexpr int min_exponent_fast_path ();
218
- static constexpr int max_exponent_fast_path ();
219
- static constexpr int max_exponent_round_to_even ();
220
- static constexpr int min_exponent_round_to_even ();
221
- static constexpr uint64_t max_mantissa_fast_path ();
222
- static constexpr int largest_power_of_ten ();
223
- static constexpr int smallest_power_of_ten ();
224
- static constexpr T exact_power_of_ten (int64_t power);
213
+ static inline constexpr int mantissa_explicit_bits ();
214
+ static inline constexpr int minimum_exponent ();
215
+ static inline constexpr int infinite_power ();
216
+ static inline constexpr int sign_index ();
217
+ static inline constexpr int min_exponent_fast_path ();
218
+ static inline constexpr int max_exponent_fast_path ();
219
+ static inline constexpr int max_exponent_round_to_even ();
220
+ static inline constexpr int min_exponent_round_to_even ();
221
+ static inline constexpr uint64_t max_mantissa_fast_path ();
222
+ static inline constexpr int largest_power_of_ten ();
223
+ static inline constexpr int smallest_power_of_ten ();
224
+ static inline constexpr T exact_power_of_ten (int64_t power);
225
225
};
226
226
227
- template <> constexpr int binary_format<double >::mantissa_explicit_bits() {
227
+ template <> inline constexpr int binary_format<double >::mantissa_explicit_bits() {
228
228
return 52 ;
229
229
}
230
- template <> constexpr int binary_format<float >::mantissa_explicit_bits() {
230
+ template <> inline constexpr int binary_format<float >::mantissa_explicit_bits() {
231
231
return 23 ;
232
232
}
233
233
234
- template <> constexpr int binary_format<double >::max_exponent_round_to_even() {
234
+ template <> inline constexpr int binary_format<double >::max_exponent_round_to_even() {
235
235
return 23 ;
236
236
}
237
237
238
- template <> constexpr int binary_format<float >::max_exponent_round_to_even() {
238
+ template <> inline constexpr int binary_format<float >::max_exponent_round_to_even() {
239
239
return 10 ;
240
240
}
241
241
242
- template <> constexpr int binary_format<double >::min_exponent_round_to_even() {
242
+ template <> inline constexpr int binary_format<double >::min_exponent_round_to_even() {
243
243
return -4 ;
244
244
}
245
245
246
- template <> constexpr int binary_format<float >::min_exponent_round_to_even() {
246
+ template <> inline constexpr int binary_format<float >::min_exponent_round_to_even() {
247
247
return -17 ;
248
248
}
249
249
250
- template <> constexpr int binary_format<double >::minimum_exponent() {
250
+ template <> inline constexpr int binary_format<double >::minimum_exponent() {
251
251
return -1023 ;
252
252
}
253
- template <> constexpr int binary_format<float >::minimum_exponent() {
253
+ template <> inline constexpr int binary_format<float >::minimum_exponent() {
254
254
return -127 ;
255
255
}
256
256
257
- template <> constexpr int binary_format<double >::infinite_power() {
257
+ template <> inline constexpr int binary_format<double >::infinite_power() {
258
258
return 0x7FF ;
259
259
}
260
- template <> constexpr int binary_format<float >::infinite_power() {
260
+ template <> inline constexpr int binary_format<float >::infinite_power() {
261
261
return 0xFF ;
262
262
}
263
263
264
- template <> constexpr int binary_format<double >::sign_index() { return 63 ; }
265
- template <> constexpr int binary_format<float >::sign_index() { return 31 ; }
264
+ template <> inline constexpr int binary_format<double >::sign_index() { return 63 ; }
265
+ template <> inline constexpr int binary_format<float >::sign_index() { return 31 ; }
266
266
267
- template <> constexpr int binary_format<double >::min_exponent_fast_path() {
267
+ template <> inline constexpr int binary_format<double >::min_exponent_fast_path() {
268
268
#if (FLT_EVAL_METHOD != 1) && (FLT_EVAL_METHOD != 0)
269
269
return 0 ;
270
270
#else
271
271
return -22 ;
272
272
#endif
273
273
}
274
- template <> constexpr int binary_format<float >::min_exponent_fast_path() {
274
+ template <> inline constexpr int binary_format<float >::min_exponent_fast_path() {
275
275
#if (FLT_EVAL_METHOD != 1) && (FLT_EVAL_METHOD != 0)
276
276
return 0 ;
277
277
#else
278
278
return -10 ;
279
279
#endif
280
280
}
281
281
282
- template <> constexpr int binary_format<double >::max_exponent_fast_path() {
282
+ template <> inline constexpr int binary_format<double >::max_exponent_fast_path() {
283
283
return 22 ;
284
284
}
285
- template <> constexpr int binary_format<float >::max_exponent_fast_path() {
285
+ template <> inline constexpr int binary_format<float >::max_exponent_fast_path() {
286
286
return 10 ;
287
287
}
288
288
289
- template <> constexpr uint64_t binary_format<double >::max_mantissa_fast_path() {
289
+ template <> inline constexpr uint64_t binary_format<double >::max_mantissa_fast_path() {
290
290
return uint64_t (2 ) << mantissa_explicit_bits ();
291
291
}
292
- template <> constexpr uint64_t binary_format<float >::max_mantissa_fast_path() {
292
+ template <> inline constexpr uint64_t binary_format<float >::max_mantissa_fast_path() {
293
293
return uint64_t (2 ) << mantissa_explicit_bits ();
294
294
}
295
295
296
296
template <>
297
- constexpr double binary_format<double >::exact_power_of_ten(int64_t power) {
297
+ inline constexpr double binary_format<double >::exact_power_of_ten(int64_t power) {
298
298
return powers_of_ten_double[power];
299
299
}
300
300
template <>
301
- constexpr float binary_format<float >::exact_power_of_ten(int64_t power) {
301
+ inline constexpr float binary_format<float >::exact_power_of_ten(int64_t power) {
302
302
303
303
return powers_of_ten_float[power];
304
304
}
305
305
306
306
307
307
template <>
308
- constexpr int binary_format<double >::largest_power_of_ten() {
308
+ inline constexpr int binary_format<double >::largest_power_of_ten() {
309
309
return 308 ;
310
310
}
311
311
template <>
312
- constexpr int binary_format<float >::largest_power_of_ten() {
312
+ inline constexpr int binary_format<float >::largest_power_of_ten() {
313
313
return 38 ;
314
314
}
315
315
316
316
template <>
317
- constexpr int binary_format<double >::smallest_power_of_ten() {
317
+ inline constexpr int binary_format<double >::smallest_power_of_ten() {
318
318
return -342 ;
319
319
}
320
320
template <>
321
- constexpr int binary_format<float >::smallest_power_of_ten() {
321
+ inline constexpr int binary_format<float >::smallest_power_of_ten() {
322
322
return -65 ;
323
323
}
324
324
0 commit comments