| 1718 | /// \exception FE_UNDERFLOW on underflows |
| 1719 | /// \exception FE_INEXACT if no other exception occurred |
| 1720 | template<std::float_round_style R,uint32 L> unsigned int log2_post(uint32 m, int ilog, int exp, unsigned int sign = 0) |
| 1721 | { |
| 1722 | uint32 msign = sign_mask(ilog); |
| 1723 | m = (((static_cast<uint32>(ilog)<<27)+(m>>4))^msign) - msign; |
| 1724 | if(!m) |
| 1725 | return 0; |
| 1726 | for(; m<0x80000000; m<<=1,--exp) ; |
| 1727 | int i = m >= L, s; |
| 1728 | exp += i; |
| 1729 | m >>= 1 + i; |
| 1730 | sign ^= msign & 0x8000; |
| 1731 | if(exp < -11) |
| 1732 | return underflow<R>(sign); |
| 1733 | m = divide64(m, L, s); |
| 1734 | return fixed2half<R,30,false,false,true>(m, exp, sign, 1); |
| 1735 | } |
| 1736 | |
| 1737 | /// Hypotenuse square root and postprocessing. |
| 1738 | /// \tparam R rounding mode to use |