Mark Wiebe <mwwi...@gmail.com> added the comment:

The patch currently assumes IEEE 754 with byte-order matching the integer type. 
I see that pyconfig.h defines three possible cases when IEEE 754 doubles are 
supported, DOUBLE_IS_LITTLE_ENDIAN_IEEE754, DOUBLE_IS_BIG_ENDIAN_IEEE754, and 
DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754. The code should have some byte swapping to 
match it to the integer endianness.

If support for non-IEEE systems is still desired, implementing a conversion 
using isnan/isinf/frexp/ldexp should be pretty easy, though off hand I can't 
see an efficient way to extract the significand bits.

Regarding the PY_LONG_LONG, it should have been unsigned PY_LONG_LONG. Using 
PY_UINT64_T is better, though, since a bigger PY_LONG_LONG would cause trouble 
in the union.

For the UINT32, maybe just using the double/PY_UINT64_T versions is better, 
since there is no macro for FLOAT_IS_IEEE754? Falling back to a frexpr 
implementation if double isn't IEEE or there is no 64-bit integer type may be a 
reasonable tradeoff to support the few platforms where that's the case, and 2 
instead of 3 separate conversion codes is a bit better maintenance-wise.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11734>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to