mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-17 03:03:24 +02:00
update msgpack_basic test for compact double packaging
update pack_double and pack_float to avoid warnings
This commit is contained in:
@@ -1140,10 +1140,10 @@ inline packer<Stream>& packer<Stream>::pack_float(float d)
|
||||
{
|
||||
if(d == d) { // check for nan
|
||||
// compare d to limits to avoid undefined behaviour
|
||||
if(d >= 0 && d <= std::numeric_limits<uint64_t>::max() && d == uint64_t(d)) {
|
||||
if(d >= 0 && d <= float(std::numeric_limits<uint64_t>::max()) && d == float(uint64_t(d))) {
|
||||
pack_imp_uint64(uint64_t(d));
|
||||
return *this;
|
||||
} else if(d >= std::numeric_limits<int64_t>::min() && d == int64_t(d)) {
|
||||
} else if(d >= float(std::numeric_limits<int64_t>::min()) && d == float(int64_t(d))) {
|
||||
pack_imp_int64(int64_t(d));
|
||||
return *this;
|
||||
}
|
||||
@@ -1162,10 +1162,10 @@ inline packer<Stream>& packer<Stream>::pack_double(double d)
|
||||
{
|
||||
if(d == d) { // check for nan
|
||||
// compare d to limits to avoid undefined behaviour
|
||||
if(d >= 0 && d <= std::numeric_limits<uint64_t>::max() && d == uint64_t(d)) {
|
||||
if(d >= 0 && d <= double(std::numeric_limits<uint64_t>::max()) && d == double(uint64_t(d))) {
|
||||
pack_imp_uint64(uint64_t(d));
|
||||
return *this;
|
||||
} else if(d >= std::numeric_limits<int64_t>::min() && d == int64_t(d)) {
|
||||
} else if(d >= double(std::numeric_limits<int64_t>::min()) && d == double(int64_t(d))) {
|
||||
pack_imp_int64(int64_t(d));
|
||||
return *this;
|
||||
}
|
||||
|
Reference in New Issue
Block a user