Skip to content

Commit

Permalink
Merge pull request #270 from makeroo/master
Browse files Browse the repository at this point in the history
Inhibited wrong occurrence of ad-hoc encoding of 64bit doubles on iOS
  • Loading branch information
redboltz committed Apr 20, 2015
2 parents cb9114e + 2f9912a commit 2919033
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
5 changes: 4 additions & 1 deletion include/msgpack/pack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,10 @@ inline packer<Stream>& packer<Stream>::pack_double(double d)
mem.f = d;
char buf[9];
buf[0] = static_cast<char>(0xcbu);
#if defined(__arm__) && !(__ARM_EABI__) // arm-oabi

#if defined(TARGET_OS_IPHONE)
// ok
#elif defined(__arm__) && !(__ARM_EABI__) // arm-oabi
// https://github.com/msgpack/msgpack-perl/pull/1
mem.i = (mem.i & 0xFFFFFFFFUL) << 32UL | (mem.i >> 32UL);
#endif
Expand Down
4 changes: 3 additions & 1 deletion include/msgpack/pack_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,9 @@ msgpack_pack_inline_func(_double)(msgpack_pack_user x, double d)
union { double f; uint64_t i; } mem;
mem.f = d;
buf[0] = 0xcb;
#if defined(__arm__) && !(__ARM_EABI__) // arm-oabi
#if defined(TARGET_OS_IPHONE)
// ok
#elif defined(__arm__) && !(__ARM_EABI__) // arm-oabi
// https://github.com/msgpack/msgpack-perl/pull/1
mem.i = (mem.i & 0xFFFFFFFFUL) << 32UL | (mem.i >> 32UL);
#endif
Expand Down
4 changes: 3 additions & 1 deletion include/msgpack/unpack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,9 @@ inline int context::execute(const char* data, std::size_t len, std::size_t& off)
case MSGPACK_CS_DOUBLE: {
union { uint64_t i; double f; } mem;
load<uint64_t>(mem.i, n);
#if defined(__arm__) && !(__ARM_EABI__) // arm-oabi
#if defined(TARGET_OS_IPHONE)
// ok
#elif defined(__arm__) && !(__ARM_EABI__) // arm-oabi
// https://github.com/msgpack/msgpack-perl/pull/1
mem.i = (mem.i & 0xFFFFFFFFUL) << 32UL | (mem.i >> 32UL);
#endif
Expand Down
4 changes: 3 additions & 1 deletion include/msgpack/unpack_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,9 @@ msgpack_unpack_func(int, _execute)(msgpack_unpack_struct(_context)* ctx, const c
case MSGPACK_CS_DOUBLE: {
union { uint64_t i; double f; } mem;
_msgpack_load64(uint64_t, n, &mem.i);
#if defined(__arm__) && !(__ARM_EABI__) // arm-oabi
#if defined(TARGET_OS_IPHONE)
// ok
#elif defined(__arm__) && !(__ARM_EABI__) // arm-oabi
// https://github.com/msgpack/msgpack-perl/pull/1
mem.i = (mem.i & 0xFFFFFFFFUL) << 32UL | (mem.i >> 32UL);
#endif
Expand Down

0 comments on commit 2919033

Please sign in to comment.