0

I am stuck at the conversion of specified bit patterns to the final value. I have the following FourCC:

SP78 SP3C SP69 SP4B SP5A

The S stands for a signed floating point. The first digit is the integer bit count while the second one stands for the fraction bit count (Although it is a FourCC, only 2 bytes are used).

So the types are:

SP78 // floating point signed, 1 sign bit, 7 bits integer, 8 fraction bits
SP3C // floating point signed, 1 sign bit, 3 bits integer, 12 fraction bits
SP69 // floating point signed, 1 sign bit, 6 bits integer, 9 fraction bits
SP4B // floating point signed, 1 sign bit, 4 bits integer, 11 fraction bits
SP5A // floating point signed, 1 sign bit, 5 bits integer, 10 fraction bits

How do I convert these bit patterns into a Double in Swift?

Regards, Sascha

inexcitus
  • 2,471
  • 2
  • 26
  • 41

0 Answers0