File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -403,9 +403,15 @@ static void pack_float_16(struct bitstream_writer_t *self_p,
403
403
{
404
404
uint8_t buf [2 ];
405
405
406
+ #if PY_VERSION_HEX >= 0x030B00A7
407
+ PyFloat_Pack2 (PyFloat_AsDouble (value_p ),
408
+ (char * )& buf [0 ],
409
+ PY_BIG_ENDIAN );
410
+ #else
406
411
_PyFloat_Pack2 (PyFloat_AsDouble (value_p ),
407
412
& buf [0 ],
408
413
PY_BIG_ENDIAN );
414
+ #endif
409
415
bitstream_writer_write_bytes (self_p , & buf [0 ], sizeof (buf ));
410
416
}
411
417
@@ -416,7 +422,11 @@ static PyObject *unpack_float_16(struct bitstream_reader_t *self_p,
416
422
double value ;
417
423
418
424
bitstream_reader_read_bytes (self_p , & buf [0 ], sizeof (buf ));
425
+ #if PY_VERSION_HEX >= 0x030B00A7
426
+ value = PyFloat_Unpack2 ((const char * )& buf [0 ], PY_BIG_ENDIAN );
427
+ #else
419
428
value = _PyFloat_Unpack2 (& buf [0 ], PY_BIG_ENDIAN );
429
+ #endif
420
430
421
431
return (PyFloat_FromDouble (value ));
422
432
}
You can’t perform that action at this time.
0 commit comments