summaryrefslogtreecommitdiff
path: root/msgpack/pack_template.h
diff options
context:
space:
mode:
Diffstat (limited to 'msgpack/pack_template.h')
-rw-r--r--msgpack/pack_template.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/msgpack/pack_template.h b/msgpack/pack_template.h
index 0e940b8..7d479b6 100644
--- a/msgpack/pack_template.h
+++ b/msgpack/pack_template.h
@@ -568,7 +568,12 @@ static inline int msgpack_pack_float(msgpack_packer* x, float d)
{
unsigned char buf[5];
buf[0] = 0xca;
+
+#if PY_VERSION_HEX >= 0x030B00A7
+ PyFloat_Pack4(d, (char *)&buf[1], 0);
+#else
_PyFloat_Pack4(d, &buf[1], 0);
+#endif
msgpack_pack_append_buffer(x, buf, 5);
}
@@ -576,7 +581,11 @@ static inline int msgpack_pack_double(msgpack_packer* x, double d)
{
unsigned char buf[9];
buf[0] = 0xcb;
+#if PY_VERSION_HEX >= 0x030B00A7
+ PyFloat_Pack8(d, (char *)&buf[1], 0);
+#else
_PyFloat_Pack8(d, &buf[1], 0);
+#endif
msgpack_pack_append_buffer(x, buf, 9);
}