31 #ifndef SDRBASE_UTIL_FIXED_H_ 32 #define SDRBASE_UTIL_FIXED_H_ 41 template<
typename IntType, u
int32_t IntBits>
73 m_nVal(nVal <<
FixedTraits<IntBits>::fixed_resolution_shift)
85 m_nVal(nVal <<
FixedTraits<IntBits>::fixed_resolution_shift)
95 m_nVal(static_cast<
int64_t>(nVal*static_cast<double>(
FixedTraits<IntBits>::fixed_resolution)))
98 m_nVal(static_cast<
int64_t>(nVal*static_cast<float>(
FixedTraits<IntBits>::fixed_resolution)))
104 m_nVal =
Fixed(other).m_nVal;
144 operator bool()
const 146 return m_nVal ? true :
false;
149 inline operator double()
const 242 return (*
this) *=
Fixed(val);
247 return (*
this) *=
Fixed(val);
300 return (*
this) /=
Fixed(val);
305 return (*
this) /=
Fixed(val);
381 template<
typename IntType, u
int32_t IntBits>
388 template<
typename IntType, u
int32_t IntBits>
391 bool const val_negative = val.
m_nVal < 0;
392 bool const this_negative =
m_nVal < 0;
393 bool const negate = val_negative ^ this_negative;
397 if (
uint64_t const self_upper = (
self >> 32)) {
403 if (
uint64_t const self_lower = (
self&0xffffffff))
407 uint64_t const lower_self_upper_other_res = self_lower*other_upper;
408 uint64_t const lower_self_lower_other_res = self_lower*other_lower;
420 template<
typename IntType, u
int32_t IntBits>
429 bool const negate_this = (
m_nVal < 0);
430 bool const negate_divisor = (divisor.
m_nVal < 0);
431 bool const negate = negate_this ^ negate_divisor;
438 bool const a_large = a > b;
445 while (temp < half_a)
460 while (a && temp && shift)
464 while(right_shift < shift && (temp > a))
482 template<
typename IntType, u
int32_t IntBits>
485 unsigned int const max_shift = 62;
486 uint64_t a_squared = 1LL << max_shift;
492 while (b_shift && (a_squared > x))
502 while (remainder && b_shift)
506 uint64_t two_a_b = (two_a_b_shift > 0) ? (a << two_a_b_shift) : (a >> -two_a_b_shift);
508 while (b_shift && (remainder < (b_squared+two_a_b)))
515 uint64_t const delta = b_squared + two_a_b;
517 if ((2*remainder) > delta)
519 a += (1LL << b_shift);
531 template<
typename IntType, u
int32_t IntBits>
559 while (!power || (temp<*log_entry))
573 res += (res >> (-power));
587 while (!power || (temp > (-*log_entry)))
601 res -= (res >> (-power));
611 template<
typename IntType, u
int32_t IntBits>
624 uint64_t const scale_position = 0x8000000000000000ULL;
626 while (temp < scale_position)
632 int64_t res = (left_shift < FixedTraits<IntBits>::max_power) ?
646 temp -= shifted_temp;
654 template<
typename IntType, u
int32_t IntBits>
657 int64_t const cordic_scale_factor = 0x22C2DD1C;
661 template<
typename IntType, u
int32_t IntBits>
664 return (shift < 0) ? (val << -shift) : (val >> shift);
667 template<
typename IntType, u
int32_t IntBits>
672 for (
int i = -1; i <= (int) FixedTraits<IntBits>::fixed_resolution_shift; ++
i)
681 theta += *arctanptr++;
687 theta -= *arctanptr++;
695 template<
typename IntType, u
int32_t IntBits>
702 for (
int i = -1; i <= (int) FixedTraits<IntBits>::fixed_resolution_shift; ++
i)
711 theta -= *arctanptr++;
717 theta += *arctanptr++;
725 template<
typename IntType, u
int32_t IntBits>
734 bool negate_cos =
false;
735 bool negate_sin =
false;
754 s->
m_nVal = negate_sin ? -x_sin : x_sin;
758 c->
m_nVal = negate_cos ? -x_cos : x_cos;
762 template<
typename IntType, u
int32_t IntBits>
770 template<
typename IntType, u
int32_t IntBits>
773 bool const negative_x = x.
m_nVal < 0;
774 bool const negative_y = y.
m_nVal < 0;
780 unsigned const max_value = 1U << FixedTraits<IntBits>::fixed_resolution_shift;
782 while ((a >= max_value) || (b >= max_value))
797 if (negative_x && negative_y) {
799 }
else if (negative_x) {
803 else if(negative_y) {
808 template<
typename IntType, u
int32_t IntBits>
816 template<
typename IntType, u
int32_t IntBits>
823 template<
typename IntType, u
int32_t IntBits>
830 template<
typename IntType, u
int32_t IntBits>
837 template<
typename IntType, u
int32_t IntBits>
844 template<
typename IntType, u
int32_t IntBits>
851 template<
typename IntType, u
int32_t IntBits>
858 template<
typename IntType, u
int32_t IntBits>
865 template<
typename IntType, u
int32_t IntBits>
872 template<
typename IntType, u
int32_t IntBits>
879 template<
typename IntType, u
int32_t IntBits>
886 template<
typename IntType, u
int32_t IntBits>
893 template<
typename IntType, u
int32_t IntBits>
900 template<
typename IntType, u
int32_t IntBits>
907 template<
typename IntType, u
int32_t IntBits>
914 template<
typename IntType, u
int32_t IntBits>
921 template<
typename IntType, u
int32_t IntBits>
928 template<
typename IntType, u
int32_t IntBits>
935 template<
typename IntType, u
int32_t IntBits>
942 template<
typename IntType, u
int32_t IntBits>
949 template<
typename IntType, u
int32_t IntBits>
956 template<
typename IntType, u
int32_t IntBits>
963 template<
typename IntType, u
int32_t IntBits>
970 template<
typename IntType, u
int32_t IntBits>
977 template<
typename IntType, u
int32_t IntBits>
984 template<
typename IntType, u
int32_t IntBits>
991 template<
typename IntType, u
int32_t IntBits>
998 template<
typename IntType, u
int32_t IntBits>
1005 template<
typename IntType, u
int32_t IntBits>
1012 template<
typename IntType, u
int32_t IntBits>
1019 template<
typename IntType, u
int32_t IntBits>
1026 template<
typename IntType, u
int32_t IntBits>
1033 template<
typename IntType, u
int32_t IntBits>
1040 template<
typename IntType, u
int32_t IntBits>
1047 template<
typename IntType, u
int32_t IntBits>
1054 template<
typename IntType, u
int32_t IntBits>
1061 template<
typename IntType, u
int32_t IntBits>
1068 template<
typename IntType, u
int32_t IntBits>
1075 template<
typename IntType, u
int32_t IntBits>
1082 template<
typename IntType, u
int32_t IntBits>
1089 template<
typename IntType, u
int32_t IntBits>
1096 template<
typename IntType, u
int32_t IntBits>
1103 template<
typename IntType, u
int32_t IntBits>
1110 template<
typename IntType, u
int32_t IntBits>
1117 template<
typename IntType, u
int32_t IntBits>
1124 template<
typename IntType, u
int32_t IntBits>
1131 template<
typename IntType, u
int32_t IntBits>
1138 template<
typename IntType, u
int32_t IntBits>
1145 template<
typename IntType, u
int32_t IntBits>
1152 template<
typename IntType, u
int32_t IntBits>
1159 template<
typename IntType, u
int32_t IntBits>
1166 template<
typename IntType, u
int32_t IntBits>
1173 template<
typename IntType, u
int32_t IntBits>
1180 template<
typename IntType, u
int32_t IntBits>
1187 template<
typename IntType, u
int32_t IntBits>
1194 template<
typename IntType, u
int32_t IntBits>
1201 template<
typename IntType, u
int32_t IntBits>
1208 template<
typename IntType, u
int32_t IntBits>
1215 template<
typename IntType, u
int32_t IntBits>
1222 template<
typename IntType, u
int32_t IntBits>
1229 template<
typename IntType, u
int32_t IntBits>
1236 template<
typename IntType, u
int32_t IntBits>
1243 template<
typename IntType, u
int32_t IntBits>
1250 template<
typename IntType, u
int32_t IntBits>
1257 template<
typename IntType, u
int32_t IntBits>
1264 template<
typename IntType, u
int32_t IntBits>
1271 template<
typename IntType, u
int32_t IntBits>
1278 template<
typename IntType, u
int32_t IntBits>
1285 template<
typename IntType, u
int32_t IntBits>
1292 template<
typename IntType, u
int32_t IntBits>
1299 template<
typename IntType, u
int32_t IntBits>
1306 template<
typename IntType, u
int32_t IntBits>
1313 template<
typename IntType, u
int32_t IntBits>
1320 template<
typename IntType, u
int32_t IntBits>
1327 template<
typename IntType, u
int32_t IntBits>
1334 template<
typename IntType, u
int32_t IntBits>
1341 template<
typename IntType, u
int32_t IntBits>
1348 template<
typename IntType, u
int32_t IntBits>
1355 template<
typename IntType, u
int32_t IntBits>
1362 template<
typename IntType, u
int32_t IntBits>
1369 template<
typename IntType, u
int32_t IntBits>
1376 template<
typename IntType, u
int32_t IntBits>
1383 template<
typename IntType, u
int32_t IntBits>
1390 template<
typename IntType, u
int32_t IntBits>
1397 template<
typename IntType, u
int32_t IntBits>
1404 template<
typename IntType, u
int32_t IntBits>
1411 template<
typename IntType, u
int32_t IntBits>
1418 template<
typename IntType, u
int32_t IntBits>
1425 template<
typename IntType, u
int32_t IntBits>
1432 template<
typename IntType, u
int32_t IntBits>
1439 template<
typename IntType, u
int32_t IntBits>
1446 template<
typename IntType, u
int32_t IntBits>
1453 template<
typename IntType, u
int32_t IntBits>
1460 template<
typename IntType, u
int32_t IntBits>
1467 template<
typename IntType, u
int32_t IntBits>
1474 template<
typename IntType, u
int32_t IntBits>
1481 template<
typename IntType, u
int32_t IntBits>
1488 template<
typename IntType, u
int32_t IntBits>
1495 template<
typename IntType, u
int32_t IntBits>
1502 template<
typename IntType, u
int32_t IntBits>
1509 template<
typename IntType, u
int32_t IntBits>
1516 template<
typename IntType, u
int32_t IntBits>
1523 template<
typename IntType, u
int32_t IntBits>
1530 template<
typename IntType, u
int32_t IntBits>
1537 template<
typename IntType, u
int32_t IntBits>
1544 template<
typename IntType, u
int32_t IntBits>
1550 template<
typename IntType, u
int32_t IntBits>
1556 template<
typename IntType, u
int32_t IntBits>
1562 template<
typename IntType, u
int32_t IntBits>
1568 template<
typename IntType, u
int32_t IntBits>
1574 template<
typename IntType, u
int32_t IntBits>
1580 template<
typename IntType, u
int32_t IntBits>
1586 template<
typename IntType, u
int32_t IntBits>
1592 template<
typename IntType, u
int32_t IntBits>
1598 template<
typename IntType, u
int32_t IntBits>
1604 template<
typename IntType, u
int32_t IntBits>
1610 template<
typename IntType, u
int32_t IntBits>
1616 template<
typename IntType, u
int32_t IntBits>
1622 template<
typename IntType, u
int32_t IntBits>
1628 template<
typename IntType, u
int32_t IntBits>
1634 template<
typename IntType, u
int32_t IntBits>
1640 template<
typename IntType, u
int32_t IntBits>
1646 template<
typename IntType, u
int32_t IntBits>
1652 template<
typename IntType, u
int32_t IntBits>
1658 template<
typename IntType, u
int32_t IntBits>
1664 template<
typename IntType, u
int32_t IntBits>
1670 template<
typename IntType, u
int32_t IntBits>
1676 template<
typename IntType, u
int32_t IntBits>
1682 template<
typename IntType, u
int32_t IntBits>
1688 template<
typename IntType, u
int32_t IntBits>
1694 template<
typename IntType, u
int32_t IntBits>
1700 template<
typename IntType, u
int32_t IntBits>
1706 template<
typename IntType, u
int32_t IntBits>
1712 template<
typename IntType, u
int32_t IntBits>
1718 template<
typename IntType, u
int32_t IntBits>
1724 template<
typename IntType, u
int32_t IntBits>
1730 template<
typename IntType, u
int32_t IntBits>
1736 template<
typename IntType, u
int32_t IntBits>
1742 template<
typename IntType, u
int32_t IntBits>
1748 template<
typename IntType, u
int32_t IntBits>
1754 template<
typename IntType, u
int32_t IntBits>
1760 template<
typename IntType, u
int32_t IntBits>
1766 template<
typename IntType, u
int32_t IntBits>
1772 template<
typename IntType, u
int32_t IntBits>
1778 template<
typename IntType, u
int32_t IntBits>
1784 template<
typename IntType, u
int32_t IntBits>
1785 inline bool operator<(double a, Fixed<IntType, IntBits>
const& b)
1790 template<
typename IntType, u
int32_t IntBits>
1791 inline bool operator<(float a, Fixed<IntType, IntBits>
const& b)
1796 template<
typename IntType, u
int32_t IntBits>
1797 inline bool operator<(uint64_t a, Fixed<IntType, IntBits>
const& b)
1802 template<
typename IntType, u
int32_t IntBits>
1803 inline bool operator<(int64_t a, Fixed<IntType, IntBits>
const& b)
1808 template<
typename IntType, u
int32_t IntBits>
1809 inline bool operator<(unsigned a, Fixed<IntType, IntBits>
const& b)
1814 template<
typename IntType, u
int32_t IntBits>
1815 inline bool operator<(int a, Fixed<IntType, IntBits>
const& b)
1820 template<
typename IntType, u
int32_t IntBits>
1821 inline bool operator<(unsigned short a, Fixed<IntType, IntBits>
const& b)
1826 template<
typename IntType, u
int32_t IntBits>
1827 inline bool operator<(short a, Fixed<IntType, IntBits>
const& b)
1832 template<
typename IntType, u
int32_t IntBits>
1833 inline bool operator<(unsigned char a, Fixed<IntType, IntBits>
const& b)
1838 template<
typename IntType, u
int32_t IntBits>
1839 inline bool operator<(char a, Fixed<IntType, IntBits>
const& b)
1844 template<
typename IntType, u
int32_t IntBits>
1845 inline bool operator<(Fixed<IntType, IntBits>
const& a,
double b)
1847 return a < Fixed<IntType, IntBits>(b);
1850 template<
typename IntType, u
int32_t IntBits>
1851 inline bool operator<(Fixed<IntType, IntBits>
const& a,
float b)
1853 return a < Fixed<IntType, IntBits>(b);
1856 template<
typename IntType, u
int32_t IntBits>
1857 inline bool operator<(Fixed<IntType, IntBits>
const& a,
uint64_t b)
1859 return a < Fixed<IntType, IntBits>(b);
1862 template<
typename IntType, u
int32_t IntBits>
1863 inline bool operator<(Fixed<IntType, IntBits>
const& a,
int64_t b)
1865 return a < Fixed<IntType, IntBits>(b);
1868 template<
typename IntType, u
int32_t IntBits>
1869 inline bool operator<(Fixed<IntType, IntBits>
const& a,
unsigned b)
1871 return a < Fixed<IntType, IntBits>(b);
1874 template<
typename IntType, u
int32_t IntBits>
1875 inline bool operator<(Fixed<IntType, IntBits>
const& a,
int b)
1877 return a < Fixed<IntType, IntBits>(b);
1880 template<
typename IntType, u
int32_t IntBits>
1881 inline bool operator<(Fixed<IntType, IntBits>
const& a,
unsigned short b)
1883 return a < Fixed<IntType, IntBits>(b);
1886 template<
typename IntType, u
int32_t IntBits>
1887 inline bool operator<(Fixed<IntType, IntBits>
const& a,
short b)
1889 return a < Fixed<IntType, IntBits>(b);
1892 template<
typename IntType, u
int32_t IntBits>
1893 inline bool operator<(Fixed<IntType, IntBits>
const& a,
unsigned char b)
1895 return a < Fixed<IntType, IntBits>(b);
1898 template<
typename IntType, u
int32_t IntBits>
1899 inline bool operator<(Fixed<IntType, IntBits>
const& a,
char b)
1901 return a < Fixed<IntType, IntBits>(b);
1904 template<
typename IntType, u
int32_t IntBits>
1910 template<
typename IntType, u
int32_t IntBits>
1916 template<
typename IntType, u
int32_t IntBits>
1922 template<
typename IntType, u
int32_t IntBits>
1928 template<
typename IntType, u
int32_t IntBits>
1934 template<
typename IntType, u
int32_t IntBits>
1940 template<
typename IntType, u
int32_t IntBits>
1946 template<
typename IntType, u
int32_t IntBits>
1952 template<
typename IntType, u
int32_t IntBits>
1958 template<
typename IntType, u
int32_t IntBits>
1964 template<
typename IntType, u
int32_t IntBits>
1970 template<
typename IntType, u
int32_t IntBits>
1976 template<
typename IntType, u
int32_t IntBits>
1982 template<
typename IntType, u
int32_t IntBits>
1988 template<
typename IntType, u
int32_t IntBits>
1994 template<
typename IntType, u
int32_t IntBits>
2000 template<
typename IntType, u
int32_t IntBits>
2006 template<
typename IntType, u
int32_t IntBits>
2012 template<
typename IntType, u
int32_t IntBits>
2018 template<
typename IntType, u
int32_t IntBits>
2024 template<
typename IntType, u
int32_t IntBits>
2025 inline bool operator<=(double a, Fixed<IntType, IntBits>
const& b)
2030 template<
typename IntType, u
int32_t IntBits>
2031 inline bool operator<=(float a, Fixed<IntType, IntBits>
const& b)
2036 template<
typename IntType, u
int32_t IntBits>
2037 inline bool operator<=(uint64_t a, Fixed<IntType, IntBits>
const& b)
2042 template<
typename IntType, u
int32_t IntBits>
2043 inline bool operator<=(int64_t a, Fixed<IntType, IntBits>
const& b)
2048 template<
typename IntType, u
int32_t IntBits>
2049 inline bool operator<=(unsigned a, Fixed<IntType, IntBits>
const& b)
2054 template<
typename IntType, u
int32_t IntBits>
2055 inline bool operator<=(int a, Fixed<IntType, IntBits>
const& b)
2060 template<
typename IntType, u
int32_t IntBits>
2061 inline bool operator<=(unsigned short a, Fixed<IntType, IntBits>
const& b)
2066 template<
typename IntType, u
int32_t IntBits>
2067 inline bool operator<=(short a, Fixed<IntType, IntBits>
const& b)
2072 template<
typename IntType, u
int32_t IntBits>
2073 inline bool operator<=(unsigned char a, Fixed<IntType, IntBits>
const& b)
2078 template<
typename IntType, u
int32_t IntBits>
2079 inline bool operator<=(char a, Fixed<IntType, IntBits>
const& b)
2084 template<
typename IntType, u
int32_t IntBits>
2085 inline bool operator<=(Fixed<IntType, IntBits>
const& a,
double b)
2087 return a <= Fixed<IntType, IntBits>(b);
2090 template<
typename IntType, u
int32_t IntBits>
2091 inline bool operator<=(Fixed<IntType, IntBits>
const& a,
float b)
2093 return a <= Fixed<IntType, IntBits>(b);
2096 template<
typename IntType, u
int32_t IntBits>
2097 inline bool operator<=(Fixed<IntType, IntBits>
const& a,
uint64_t b)
2099 return a <= Fixed<IntType, IntBits>(b);
2102 template<
typename IntType, u
int32_t IntBits>
2103 inline bool operator<=(Fixed<IntType, IntBits>
const& a,
int64_t b)
2105 return a <= Fixed<IntType, IntBits>(b);
2108 template<
typename IntType, u
int32_t IntBits>
2109 inline bool operator<=(Fixed<IntType, IntBits>
const& a,
unsigned b)
2111 return a <= Fixed<IntType, IntBits>(b);
2114 template<
typename IntType, u
int32_t IntBits>
2115 inline bool operator<=(Fixed<IntType, IntBits>
const& a,
int b)
2117 return a <= Fixed<IntType, IntBits>(b);
2120 template<
typename IntType, u
int32_t IntBits>
2121 inline bool operator<=(Fixed<IntType, IntBits>
const& a,
unsigned short b)
2123 return a <= Fixed<IntType, IntBits>(b);
2126 template<
typename IntType, u
int32_t IntBits>
2127 inline bool operator<=(Fixed<IntType, IntBits>
const& a,
short b)
2129 return a <= Fixed<IntType, IntBits>(b);
2132 template<
typename IntType, u
int32_t IntBits>
2133 inline bool operator<=(Fixed<IntType, IntBits>
const& a,
unsigned char b)
2135 return a <= Fixed<IntType, IntBits>(b);
2138 template<
typename IntType, u
int32_t IntBits>
2139 inline bool operator<=(Fixed<IntType, IntBits>
const& a,
char b)
2141 return a <= Fixed<IntType, IntBits>(b);
2144 template<
typename IntType, u
int32_t IntBits>
2150 template<
typename IntType, u
int32_t IntBits>
2156 template<
typename IntType, u
int32_t IntBits>
2162 template<
typename IntType, u
int32_t IntBits>
2168 template<
typename IntType, u
int32_t IntBits>
2174 template<
typename IntType, u
int32_t IntBits>
2180 template<
typename IntType, u
int32_t IntBits>
2186 template<
typename IntType, u
int32_t IntBits>
2192 template<
typename IntType, u
int32_t IntBits>
2198 template<
typename IntType, u
int32_t IntBits>
2204 template<
typename IntType, u
int32_t IntBits>
2210 template<
typename IntType, u
int32_t IntBits>
2216 template<
typename IntType, u
int32_t IntBits>
2222 template<
typename IntType, u
int32_t IntBits>
2228 template<
typename IntType, u
int32_t IntBits>
2234 template<
typename IntType, u
int32_t IntBits>
2240 template<
typename IntType, u
int32_t IntBits>
2246 template<
typename IntType, u
int32_t IntBits>
2252 template<
typename IntType, u
int32_t IntBits>
2258 template<
typename IntType, u
int32_t IntBits>
2264 template<
typename IntType, u
int32_t IntBits>
2270 template<
typename IntType, u
int32_t IntBits>
2276 template<
typename IntType, u
int32_t IntBits>
2282 template<
typename IntType, u
int32_t IntBits>
2288 template<
typename IntType, u
int32_t IntBits>
2294 template<
typename IntType, u
int32_t IntBits>
2300 template<
typename IntType, u
int32_t IntBits>
2306 template<
typename IntType, u
int32_t IntBits>
2312 template<
typename IntType, u
int32_t IntBits>
2318 template<
typename IntType, u
int32_t IntBits>
2321 return x.
modf(integral_part);
2324 template<
typename IntType, u
int32_t IntBits>
2334 template<
typename IntType, u
int32_t IntBits>
2352 template<
typename IntType, u
int32_t IntBits>
2360 template<
typename IntType, u
int32_t IntBits>
2368 template<
typename IntType, u
int32_t IntBits>
2376 template<
typename IntType, u
int32_t IntBits>
2382 template<
typename IntType, u
int32_t IntBits>
2388 template<
typename IntType, u
int32_t IntBits>
2392 if ((
m_nVal < 0) && (fractional_part > 0)) {
2400 template<
typename IntType, u
int32_t IntBits>
2408 template<
typename IntType, u
int32_t IntBits>
2413 return std::complex<Fixed<IntType, IntBits> >(rho * c, rho * s);
2416 template<
typename IntType, u
int32_t IntBits>
2419 template<
typename IntType, u
int32_t IntBits>
2422 template<
typename IntType, u
int32_t IntBits>
2425 template<
typename IntType, u
int32_t IntBits>
2428 template<
typename IntType, u
int32_t IntBits>
2431 template<
typename IntType, u
int32_t IntBits>
2434 template<
typename IntType, u
int32_t IntBits>
2437 template<
typename IntType, u
int32_t IntBits>
Fixed & operator/=(unsigned short val)
friend bool operator<(Fixed const &lhs, Fixed const &rhs)
static const Fixed fixed_max
Fixed & operator*=(unsigned char val)
static const Fixed fixed_half
Fixed(internal, IntType nVal)
static const Fixed fixed_two_pi
static void perform_cordic_polarization(int64_t &argx, int64_t &argy)
static void to_polar(Fixed const &x, Fixed const &y, Fixed *r, Fixed *theta)
Fixed & operator=(Fixed const &other)
friend bool operator>(Fixed const &lhs, Fixed const &rhs)
Fixed & operator/=(double val)
Fixed< IntType, IntBits > operator*(double a, Fixed< IntType, IntBits > const &b)
static void sin_cos(Fixed const &theta, Fixed *s, Fixed *c)
static const Fixed fixed_pi
uint64_t as_unsigned_long() const
Fixed & operator-=(Fixed const &val)
Fixed & operator/=(short val)
Fixed & operator*=(char val)
Fixed & operator*=(uint64_t val)
Fixed & operator*=(unsigned int val)
static const Fixed fixed_quarter_pi
Fixed & operator/=(unsigned char val)
unsigned short as_unsigned_short() const
Fixed & operator%=(Fixed const &other)
friend bool operator!=(Fixed const &lhs, Fixed const &rhs)
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Fixed & operator*=(short val)
Fixed & operator*=(Fixed const &val)
Fixed & operator/=(Fixed const &val)
Fixed & operator*=(int64_t val)
Fixed & operator*=(float val)
Fixed & operator=(T other)
unsigned int as_unsigned_int() const
friend bool operator>=(Fixed const &lhs, Fixed const &rhs)
Fixed & operator/=(unsigned int val)
Fixed & operator+=(Fixed const &val)
static int64_t scale_cordic_result(int64_t a)
static int64_t right_shift(int64_t val, int shift)
Fixed & operator*=(double val)
Fixed< IntType, IntBits > operator/(double a, Fixed< IntType, IntBits > const &b)
IntType as_internal() const
static const Fixed fixed_half_pi
Fixed & operator/=(int64_t val)
static void perform_cordic_rotation(int64_t &px, int64_t &py, int64_t theta)
Fixed< IntType, IntBits > operator%(double a, Fixed< IntType, IntBits > const &b)
Fixed(unsigned short nVal)
Fixed & operator*=(unsigned short val)
Fixed< IntType, IntBits > operator+(double a, Fixed< IntType, IntBits > const &b)
Fixed & operator/=(char val)
friend bool operator<=(Fixed const &lhs, Fixed const &rhs)
std::complex< Fixed< IntType, IntBits > > polar(const Fixed< IntType, IntBits > &rho, const Fixed< IntType, IntBits > &theta)
Fixed & operator/=(int val)
static const Fixed fixed_one
friend bool operator==(Fixed const &lhs, Fixed const &rhs)
Fixed & operator*=(int val)
Fixed & operator/=(float val)
uint64_t as_unsigned_int64() const
Fixed & operator/=(uint64_t val)
T max(const T &x, const T &y)
Fixed modf(Fixed *integral_part) const
static const Fixed fixed_zero
unsigned __int64 uint64_t