@@ -203,31 +203,33 @@ class JSON_API Value {
203
203
static Value const & nullSingleton ();
204
204
205
205
// / Minimum signed integer value that can be stored in a Json::Value.
206
- static const LargestInt minLargestInt;
206
+ static constexpr LargestInt minLargestInt = LargestInt(~(LargestUInt(- 1 ) / 2 )) ;
207
207
// / Maximum signed integer value that can be stored in a Json::Value.
208
- static const LargestInt maxLargestInt;
208
+ static constexpr LargestInt maxLargestInt = LargestInt(LargestUInt(- 1 ) / 2 ) ;
209
209
// / Maximum unsigned integer value that can be stored in a Json::Value.
210
- static const LargestUInt maxLargestUInt;
210
+ static constexpr LargestUInt maxLargestUInt = LargestUInt(- 1 ) ;
211
211
212
212
// / Minimum signed int value that can be stored in a Json::Value.
213
- static const Int minInt;
213
+ static constexpr Int minInt = Int(~(UInt(- 1 ) / 2 )) ;
214
214
// / Maximum signed int value that can be stored in a Json::Value.
215
- static const Int maxInt;
215
+ static constexpr Int maxInt = Int(UInt(- 1 ) / 2 ) ;
216
216
// / Maximum unsigned int value that can be stored in a Json::Value.
217
- static const UInt maxUInt;
217
+ static constexpr UInt maxUInt = UInt(- 1 ) ;
218
218
219
219
#if defined(JSON_HAS_INT64)
220
220
// / Minimum signed 64 bits int value that can be stored in a Json::Value.
221
- static const Int64 minInt64;
221
+ static constexpr Int64 minInt64 = Int64(~(UInt64(- 1 ) / 2 )) ;
222
222
// / Maximum signed 64 bits int value that can be stored in a Json::Value.
223
- static const Int64 maxInt64;
223
+ static constexpr Int64 maxInt64 = Int64(UInt64(- 1 ) / 2 ) ;
224
224
// / Maximum unsigned 64 bits int value that can be stored in a Json::Value.
225
- static const UInt64 maxUInt64;
225
+ static constexpr UInt64 maxUInt64 = UInt64(- 1 ) ;
226
226
#endif // defined(JSON_HAS_INT64)
227
-
228
227
// / Default precision for real value for string representation.
229
- static const UInt defaultRealPrecision;
230
-
228
+ static constexpr UInt defaultRealPrecision = 17 ;
229
+ // The constant is hard-coded because some compiler have trouble
230
+ // converting Value::maxUInt64 to a double correctly (AIX/xlC).
231
+ // Assumes that UInt64 is a 64 bits integer.
232
+ static constexpr double maxUInt64AsDouble = 18446744073709551615.0 ;
231
233
// Workaround for bug in the NVIDIAs CUDA 9.1 nvcc compiler
232
234
// when using gcc and clang backend compilers. CZString
233
235
// cannot be defined as private. See issue #486
0 commit comments