mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-13 10:22:55 +01:00
For gcc>=6 JSON_USE_INT64_DOUBLE_CONVERSION
This commit is contained in:
parent
9a4b1e39bf
commit
95f120f68e
@ -114,6 +114,10 @@
|
|||||||
#define JSONCPP_DEPRECATED(message)
|
#define JSONCPP_DEPRECATED(message)
|
||||||
#endif // if !defined(JSONCPP_DEPRECATED)
|
#endif // if !defined(JSONCPP_DEPRECATED)
|
||||||
|
|
||||||
|
#if __GNUC__ >= 6
|
||||||
|
# define JSON_USE_INT64_DOUBLE_CONVERSION 1
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Json {
|
namespace Json {
|
||||||
typedef int Int;
|
typedef int Int;
|
||||||
typedef unsigned int UInt;
|
typedef unsigned int UInt;
|
||||||
|
@ -784,7 +784,8 @@ float Value::asFloat() const {
|
|||||||
#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
|
#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
|
||||||
return static_cast<float>(value_.uint_);
|
return static_cast<float>(value_.uint_);
|
||||||
#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
|
#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
|
||||||
return integerToDouble(value_.uint_);
|
// This can fail (silently?) if the value is bigger than MAX_FLOAT.
|
||||||
|
return static_cast<float>(integerToDouble(value_.uint_));
|
||||||
#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
|
#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
|
||||||
case realValue:
|
case realValue:
|
||||||
return static_cast<float>(value_.real_);
|
return static_cast<float>(value_.real_);
|
||||||
|
Loading…
Reference in New Issue
Block a user