diff --git a/include/msgpack/v1/pack.hpp b/include/msgpack/v1/pack.hpp index 07a89fb1..1c48c52d 100644 --- a/include/msgpack/v1/pack.hpp +++ b/include/msgpack/v1/pack.hpp @@ -1138,13 +1138,12 @@ inline packer& packer::pack_unsigned_long_long(unsigned long lon template inline packer& packer::pack_float(float d) { - if (d == d) { // check for nan - // compare d to limits::max() to avoid undefined behaviour - if (d >= 0 && d <= std::numeric_limits::max() && d == uint64_t(d)) { + if(d == d) { // check for nan + // compare d to limits to avoid undefined behaviour + if(d >= 0 && d <= std::numeric_limits::max() && d == uint64_t(d)) { pack_imp_uint64(uint64_t(d)); - return *this; - - } else if (d >= std::numeric_limits::min() && d == int64_t(d)) { + return *this; + } else if(d >= std::numeric_limits::min() && d == int64_t(d)) { pack_imp_int64(int64_t(d)); return *this; } @@ -1161,13 +1160,12 @@ inline packer& packer::pack_float(float d) template inline packer& packer::pack_double(double d) { - if (d == d) { // check for nan - // compare d to limits::max() to avoid undefined behaviour - if (d >= 0 && d <= std::numeric_limits::max() && d == uint64_t(d)) { + if(d == d) { // check for nan + // compare d to limits to avoid undefined behaviour + if(d >= 0 && d <= std::numeric_limits::max() && d == uint64_t(d)) { pack_imp_uint64(uint64_t(d)); - return *this; - - } else if (d >= std::numeric_limits::min() && d == int64_t(d)) { + return *this; + } else if(d >= std::numeric_limits::min() && d == int64_t(d)) { pack_imp_int64(int64_t(d)); return *this; }