mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-03-30 07:26:29 +02:00
Fix pack/unpack for double on arm-oabi
This commit is contained in:
parent
6f043e3326
commit
3bec736aee
@ -646,7 +646,12 @@ msgpack_pack_inline_func(_double)(msgpack_pack_user x, double d)
|
||||
union { double f; uint64_t i; } mem;
|
||||
mem.f = d;
|
||||
unsigned char buf[9];
|
||||
buf[0] = 0xcb; _msgpack_store64(&buf[1], mem.i);
|
||||
buf[0] = 0xcb;
|
||||
#if defined(__arm__) && !(__ARM_EABI__) // arm-oabi
|
||||
// https://github.com/msgpack/msgpack-perl/pull/1
|
||||
mem.i = (mem.i & 0xFFFFFFFFUL) << 32UL | (mem.i >> 32UL);
|
||||
#endif
|
||||
_msgpack_store64(&buf[1], mem.i);
|
||||
msgpack_pack_append_buffer(x, buf, 9);
|
||||
}
|
||||
|
||||
|
@ -263,6 +263,10 @@ msgpack_unpack_func(int, _execute)(msgpack_unpack_struct(_context)* ctx, const c
|
||||
case CS_DOUBLE: {
|
||||
union { uint64_t i; double f; } mem;
|
||||
mem.i = _msgpack_load64(uint64_t,n);
|
||||
#if defined(__arm__) && !(__ARM_EABI__) // arm-oabi
|
||||
// https://github.com/msgpack/msgpack-perl/pull/1
|
||||
mem.i = (mem.i & 0xFFFFFFFFUL) << 32UL | (mem.i >> 32UL);
|
||||
#endif
|
||||
push_fixed_value(_double, mem.f); }
|
||||
case CS_UINT_8:
|
||||
push_fixed_value(_uint8, *(uint8_t*)n);
|
||||
|
Loading…
x
Reference in New Issue
Block a user