I want to create an extension for
BinaryFloatingPoint to convert between an array of bytes to a floating point number, with an endianness flag. If the flag matches with the system's endianness, I'd return the value as returned by
buffer.load(as: X.self), but I need to byte swap it in case the endiannesses don't match.
I'm trying to go by swapping the bytes from the sign, exponent and significand bit patterns but it's giving me a wrong result.
FixedWidthInteger, I would just call
byteSwapped and if I was doing an extension for each floating point type, swapping the
bitPattern would be enough.
I don't know if this is something feasible in an efficient way but I want to exhaust this option before moving to individual conformances.
Thank you in advance for any support.