Decompression implementation. \param arg number to decompress \param iptr address to store integer part at \return fractional part
| 1699 | /// \param iptr address to store integer part at |
| 1700 | /// \return fractional part |
| 1701 | static half modf(half arg, half *iptr) |
| 1702 | { |
| 1703 | unsigned int e = arg.data_ & 0x7FFF; |
| 1704 | if(e >= 0x6400) |
| 1705 | return *iptr = arg, half(binary, arg.data_&(0x8000U|-(e>0x7C00))); |
| 1706 | if(e < 0x3C00) |
| 1707 | return iptr->data_ = arg.data_ & 0x8000, arg; |
| 1708 | e >>= 10; |
| 1709 | unsigned int mask = (1<<(25-e)) - 1, m = arg.data_ & mask; |
| 1710 | iptr->data_ = arg.data_ & ~mask; |
| 1711 | if(!m) |
| 1712 | return half(binary, arg.data_&0x8000); |
| 1713 | for(; m<0x400; m<<=1,--e) ; |
| 1714 | return half(binary, static_cast<uint16>((arg.data_&0x8000)|(e<<10)|(m&0x3FF))); |
| 1715 | } |
| 1716 | |
| 1717 | /// Scaling implementation. |
| 1718 | /// \param arg number to scale |