SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
fixed.h
Go to the documentation of this file.
1 // (C) Copyright 2007 Anthony Williams //
3 // //
4 // Distributed under the Boost Software License, Version 1.0. //
5 // See: http://www.boost.org/LICENSE_1_0.txt) //
6 // //
7 // Original article: //
8 // http://www.drdobbs.com/cpp/optimizing-math-intensive-applications-w/207000448 //
9 // //
10 // Copyright (C) 2018 Edouard Griffiths, F4EXB //
11 // //
12 // Modified as fully templatized class with variable size and type internal //
13 // representation //
14 // //
15 // sqrt requires even IntBits //
16 // //
17 // This program is free software; you can redistribute it and/or modify //
18 // it under the terms of the GNU General Public License as published by //
19 // the Free Software Foundation as version 3 of the License, or //
20 // (at your option) any later version. //
21 // //
22 // This program is distributed in the hope that it will be useful, //
23 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
24 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
25 // GNU General Public License V3 for more details. //
26 // //
27 // You should have received a copy of the GNU General Public License //
28 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
30 
31 #ifndef SDRBASE_UTIL_FIXED_H_
32 #define SDRBASE_UTIL_FIXED_H_
33 
34 #include <ostream>
35 #include <complex>
36 #include <limits>
37 #include <stdint.h>
38 
39 #include "fixedtraits.h"
40 
41 template<typename IntType, uint32_t IntBits>
42 class Fixed
43 {
44 private:
45  IntType m_nVal;
46 
48  static int64_t right_shift(int64_t val,int shift);
49  static void perform_cordic_rotation(int64_t&px, int64_t&py, int64_t theta);
50  static void perform_cordic_polarization(int64_t& argx, int64_t&argy);
51 
52 public:
53  static const Fixed fixed_max;
54  static const Fixed fixed_one;
55  static const Fixed fixed_zero;
56  static const Fixed fixed_half;
57  static const Fixed fixed_pi;
58  static const Fixed fixed_two_pi;
59  static const Fixed fixed_half_pi;
60  static const Fixed fixed_quarter_pi;
61 
62  struct internal
63  {};
64 
65  Fixed():
66  m_nVal(0)
67  {}
68 
69  Fixed(internal, IntType nVal):
70  m_nVal(nVal)
71  {}
72  Fixed(int64_t nVal):
73  m_nVal(nVal << FixedTraits<IntBits>::fixed_resolution_shift)
74  {}
75 
76  Fixed(int nVal):
77  m_nVal(int64_t(nVal) << FixedTraits<IntBits>::fixed_resolution_shift)
78  {}
79 
80  Fixed(short nVal):
81  m_nVal(int64_t(nVal) << FixedTraits<IntBits>::fixed_resolution_shift)
82  {}
83 
84  Fixed(uint64_t nVal):
85  m_nVal(nVal << FixedTraits<IntBits>::fixed_resolution_shift)
86  {}
87 
88  Fixed(unsigned int nVal):
89  m_nVal(int64_t(nVal) << FixedTraits<IntBits>::fixed_resolution_shift)
90  {}
91  Fixed(unsigned short nVal):
92  m_nVal(int64_t(nVal) << FixedTraits<IntBits>::fixed_resolution_shift)
93  {}
94  Fixed(double nVal):
95  m_nVal(static_cast<int64_t>(nVal*static_cast<double>(FixedTraits<IntBits>::fixed_resolution)))
96  {}
97  Fixed(float nVal):
98  m_nVal(static_cast<int64_t>(nVal*static_cast<float>(FixedTraits<IntBits>::fixed_resolution)))
99  {}
100 
101  template<typename T>
102  Fixed& operator=(T other)
103  {
104  m_nVal = Fixed(other).m_nVal;
105  return *this;
106  }
107 
108  Fixed& operator=(Fixed const& other)
109  {
110  m_nVal = other.m_nVal;
111  return *this;
112  }
113 
114  friend bool operator==(Fixed const& lhs,Fixed const& rhs)
115  {
116  return lhs.m_nVal == rhs.m_nVal;
117  }
118 
119  friend bool operator!=(Fixed const& lhs,Fixed const& rhs)
120  {
121  return lhs.m_nVal != rhs.m_nVal;
122  }
123 
124  friend bool operator<(Fixed const& lhs,Fixed const& rhs)
125  {
126  return lhs.m_nVal < rhs.m_nVal;
127  }
128 
129  friend bool operator>(Fixed const& lhs,Fixed const& rhs)
130  {
131  return lhs.m_nVal > rhs.m_nVal;
132  }
133 
134  friend bool operator<=(Fixed const& lhs,Fixed const& rhs)
135  {
136  return lhs.m_nVal <= rhs.m_nVal;
137  }
138 
139  friend bool operator>=(Fixed const& lhs,Fixed const& rhs)
140  {
141  return lhs.m_nVal >= rhs.m_nVal;
142  }
143 
144  operator bool() const
145  {
146  return m_nVal ? true : false;
147  }
148 
149  inline operator double() const
150  {
151  return as_double();
152  }
153 
154  IntType as_internal() const
155  {
156  return m_nVal;
157  }
158 
159  float as_float() const
160  {
161  return m_nVal / (float) FixedTraits<IntBits>::fixed_resolution;
162  }
163 
164  double as_double() const
165  {
166  return m_nVal / (double) FixedTraits<IntBits>::fixed_resolution;
167  }
168 
169  int64_t as_long() const
170  {
172  }
174  {
176  }
177 
178  int as_int() const
179  {
180  return (int) (m_nVal / FixedTraits<IntBits>::fixed_resolution);
181  }
182 
184  {
186  }
188  {
190  }
191 
192  unsigned int as_unsigned_int() const
193  {
194  return (unsigned int) (m_nVal / FixedTraits<IntBits>::fixed_resolution);
195  }
196 
197  short as_short() const
198  {
199  return (short) (m_nVal / FixedTraits<IntBits>::fixed_resolution);
200  }
201 
202  unsigned short as_unsigned_short() const
203  {
204  return (unsigned short) (m_nVal / FixedTraits<IntBits>::fixed_resolution);
205  }
206 
208  {
210  return *this;
211  }
212 
214  {
216  return *this;
217  }
218 
219  Fixed floor() const;
220  Fixed ceil() const;
221  Fixed sqrt() const;
222  Fixed exp() const;
223  Fixed log() const;
224  Fixed& operator%=(Fixed const& other);
225  Fixed& operator*=(Fixed const& val);
226  Fixed& operator/=(Fixed const& val);
227 
228  Fixed& operator-=(Fixed const& val)
229  {
230  m_nVal -= val.m_nVal;
231  return *this;
232  }
233 
234  Fixed& operator+=(Fixed const& val)
235  {
236  m_nVal += val.m_nVal;
237  return *this;
238  }
239 
240  Fixed& operator*=(double val)
241  {
242  return (*this) *= Fixed(val);
243  }
244 
245  Fixed& operator*=(float val)
246  {
247  return (*this) *= Fixed(val);
248  }
249 
251  {
252  m_nVal *= val;
253  return *this;
254  }
255 
256  Fixed& operator*=(int val)
257  {
258  m_nVal *= val;
259  return *this;
260  }
261 
262  Fixed& operator*=(short val)
263  {
264  m_nVal *= val;
265  return *this;
266  }
267 
268  Fixed& operator*=(char val)
269  {
270  m_nVal *= val;
271  return *this;
272  }
273 
275  {
276  m_nVal *= val;
277  return *this;
278  }
279 
280  Fixed& operator*=(unsigned int val)
281  {
282  m_nVal *= val;
283  return *this;
284  }
285 
286  Fixed& operator*=(unsigned short val)
287  {
288  m_nVal *= val;
289  return *this;
290  }
291 
292  Fixed& operator*=(unsigned char val)
293  {
294  m_nVal *= val;
295  return *this;
296  }
297 
298  Fixed& operator/=(double val)
299  {
300  return (*this) /= Fixed(val);
301  }
302 
303  Fixed& operator/=(float val)
304  {
305  return (*this) /= Fixed(val);
306  }
307 
309  {
310  m_nVal /= val;
311  return *this;
312  }
313 
314  Fixed& operator/=(int val)
315  {
316  m_nVal /= val;
317  return *this;
318  }
319 
320  Fixed& operator/=(short val)
321  {
322  m_nVal /= val;
323  return *this;
324  }
325 
326  Fixed& operator/=(char val)
327  {
328  m_nVal /= val;
329  return *this;
330  }
331 
333  {
334  m_nVal /= val;
335  return *this;
336  }
337 
338  Fixed& operator/=(unsigned int val)
339  {
340  m_nVal/=val;
341  return *this;
342  }
343 
344  Fixed& operator/=(unsigned short val)
345  {
346  m_nVal /= val;
347  return *this;
348  }
349 
350  Fixed& operator/=(unsigned char val)
351  {
352  m_nVal /= val;
353  return *this;
354  }
355 
356  bool operator!() const
357  {
358  return m_nVal == 0;
359  }
360 
361  Fixed modf(Fixed* integral_part) const;
362  Fixed atan() const;
363 
364  static void sin_cos(Fixed const& theta,Fixed* s,Fixed*c);
365  static void to_polar(Fixed const& x,Fixed const& y,Fixed* r,Fixed*theta);
366 
367  Fixed sin() const;
368  Fixed cos() const;
369  Fixed tan() const;
370  Fixed operator-() const;
371  Fixed abs() const;
372 };
373 
374 /* why always as double ?
375 inline std::ostream& operator<<(std::ostream& os,fixed const& value)
376 {
377  return os<<value.as_double();
378 }
379 */
380 
381 template<typename IntType, uint32_t IntBits>
383 {
384  m_nVal = m_nVal%other.m_nVal;
385  return *this;
386 }
387 
388 template<typename IntType, uint32_t IntBits>
390 {
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;
394  uint64_t const other = val_negative ? -val.m_nVal : val.m_nVal;
395  uint64_t const self = this_negative ? -m_nVal : m_nVal;
396 
397  if (uint64_t const self_upper = (self >> 32)) {
398  m_nVal = (self_upper*other) << (32 - FixedTraits<IntBits>::fixed_resolution_shift);
399  } else {
400  m_nVal = 0;
401  }
402 
403  if (uint64_t const self_lower = (self&0xffffffff))
404  {
405  uint64_t const other_upper = static_cast<uint64_t>(other >> 32);
406  uint64_t const other_lower = static_cast<uint64_t>(other & 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;
409  m_nVal += (lower_self_upper_other_res << (32 - FixedTraits<IntBits>::fixed_resolution_shift))
410  + (lower_self_lower_other_res >> FixedTraits<IntBits>::fixed_resolution_shift);
411  }
412 
413  if (negate) {
414  m_nVal=-m_nVal;
415  }
416 
417  return *this;
418 }
419 
420 template<typename IntType, uint32_t IntBits>
422 {
423  if( !divisor.m_nVal)
424  {
426  }
427  else
428  {
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;
432  uint64_t a = negate_this ? -m_nVal : m_nVal;
433  uint64_t b = negate_divisor ? -divisor.m_nVal : divisor.m_nVal;
434 
435  uint64_t res = 0;
436 
437  uint64_t temp = b;
438  bool const a_large = a > b;
440 
441  if(a_large)
442  {
443  uint64_t const half_a = a>>1;
444 
445  while (temp < half_a)
446  {
447  temp <<= 1;
448  ++shift;
449  }
450  }
451 
452  uint64_t d = 1LL << shift;
453 
454  if (a_large)
455  {
456  a -= temp;
457  res += d;
458  }
459 
460  while (a && temp && shift)
461  {
462  unsigned right_shift = 0;
463 
464  while(right_shift < shift && (temp > a))
465  {
466  temp >>= 1;
467  ++right_shift;
468  }
469 
470  d >>= right_shift;
471  shift -= right_shift;
472  a -= temp;
473  res += d;
474  }
475 
476  m_nVal = (negate ? -(int64_t) res : res);
477  }
478 
479  return *this;
480 }
481 
482 template<typename IntType, uint32_t IntBits>
484 {
485  unsigned int const max_shift = 62;
486  uint64_t a_squared = 1LL << max_shift;
487  unsigned int b_shift = (max_shift + FixedTraits<IntBits>::fixed_resolution_shift) / 2;
488  uint64_t a = 1LL << b_shift;
489 
490  uint64_t x = m_nVal;
491 
492  while (b_shift && (a_squared > x))
493  {
494  a >>= 1;
495  a_squared >>= 2;
496  --b_shift;
497  }
498 
499  uint64_t remainder = x - a_squared;
500  --b_shift;
501 
502  while (remainder && b_shift)
503  {
504  uint64_t b_squared = 1LL << (2*b_shift - FixedTraits<IntBits>::fixed_resolution_shift);
505  int const two_a_b_shift = b_shift + 1 - FixedTraits<IntBits>::fixed_resolution_shift;
506  uint64_t two_a_b = (two_a_b_shift > 0) ? (a << two_a_b_shift) : (a >> -two_a_b_shift);
507 
508  while (b_shift && (remainder < (b_squared+two_a_b)))
509  {
510  b_squared >>= 2;
511  two_a_b >>= 1;
512  --b_shift;
513  }
514 
515  uint64_t const delta = b_squared + two_a_b;
516 
517  if ((2*remainder) > delta)
518  {
519  a += (1LL << b_shift);
520  remainder -= delta;
521 
522  if (b_shift) {
523  --b_shift;
524  }
525  }
526  }
527 
529 }
530 
531 template<typename IntType, uint32_t IntBits>
533 {
535  {
536  return fixed_max;
537  }
538 
540  {
541  return Fixed<IntType, IntBits>(internal(), 0);
542  }
543 
544  if (!m_nVal)
545  {
547  }
548 
550 
551  if (m_nVal > 0)
552  {
555  int64_t temp=m_nVal;
556 
557  while (temp && power>(-(int)FixedTraits<IntBits>::fixed_resolution_shift))
558  {
559  while (!power || (temp<*log_entry))
560  {
561  if (!power) {
563  } else {
564  ++log_entry;
565  }
566 
567  --power;
568  }
569 
570  temp -= *log_entry;
571 
572  if (power < 0) {
573  res += (res >> (-power));
574  } else {
575  res <<= power;
576  }
577  }
578  }
579  else
580  {
583  int64_t temp=m_nVal;
584 
585  while (temp && (power > (-(int) FixedTraits<IntBits>::fixed_resolution_shift)))
586  {
587  while (!power || (temp > (-*log_entry)))
588  {
589  if(!power) {
591  } else {
592  ++log_entry;
593  }
594 
595  --power;
596  }
597 
598  temp += *log_entry;
599 
600  if (power <0 ) {
601  res -= (res >> (-power));
602  } else {
603  res >>= power;
604  }
605  }
606  }
607 
609 }
610 
611 template<typename IntType, uint32_t IntBits>
613 {
614  if ( m_nVal <= 0) {
615  return -fixed_max;
616  }
617 
619  return fixed_zero;
620  }
621 
622  uint64_t temp = m_nVal;
623  int left_shift = 0;
624  uint64_t const scale_position = 0x8000000000000000ULL;
625 
626  while (temp < scale_position)
627  {
628  ++left_shift;
629  temp <<= 1;
630  }
631 
632  int64_t res = (left_shift < FixedTraits<IntBits>::max_power) ?
635  unsigned int right_shift = 1;
636  uint64_t shifted_temp = temp >> 1;
637 
638  while (temp && (right_shift < FixedTraits<IntBits>::fixed_resolution_shift))
639  {
640  while ((right_shift < FixedTraits<IntBits>::fixed_resolution_shift) && (temp < (shifted_temp + scale_position)))
641  {
642  shifted_temp >>= 1;
643  ++right_shift;
644  }
645 
646  temp -= shifted_temp;
647  shifted_temp = temp >> right_shift;
649  }
650 
652 }
653 
654 template<typename IntType, uint32_t IntBits>
656 {
657  int64_t const cordic_scale_factor = 0x22C2DD1C; /* 0.271572 * 2^31*/
658  return (int64_t)((((int64_t)a)*cordic_scale_factor) >> 31);
659 }
660 
661 template<typename IntType, uint32_t IntBits>
663 {
664  return (shift < 0) ? (val << -shift) : (val >> shift);
665 }
666 
667 template<typename IntType, uint32_t IntBits>
669 {
670  int64_t x = px, y = py;
671  int64_t const *arctanptr = FixedTraits<IntBits>::arctantab;
672  for (int i = -1; i <= (int) FixedTraits<IntBits>::fixed_resolution_shift; ++i)
673  {
674  int64_t const yshift = right_shift(y,i);
675  int64_t const xshift = right_shift(x,i);
676 
677  if (theta < 0)
678  {
679  x += yshift;
680  y -= xshift;
681  theta += *arctanptr++;
682  }
683  else
684  {
685  x -= yshift;
686  y += xshift;
687  theta -= *arctanptr++;
688  }
689  }
690 
691  px = scale_cordic_result(x);
692  py = scale_cordic_result(y);
693 }
694 
695 template<typename IntType, uint32_t IntBits>
697 {
698  int64_t theta = 0;
699  int64_t x = argx, y = argy;
700  int64_t const *arctanptr = FixedTraits<IntBits>::arctantab;
701 
702  for (int i = -1; i <= (int) FixedTraits<IntBits>::fixed_resolution_shift; ++i)
703  {
704  int64_t const yshift = right_shift(y,i);
705  int64_t const xshift = right_shift(x,i);
706 
707  if(y < 0)
708  {
709  y += xshift;
710  x -= yshift;
711  theta -= *arctanptr++;
712  }
713  else
714  {
715  y -= xshift;
716  x += yshift;
717  theta += *arctanptr++;
718  }
719  }
720 
721  argx = scale_cordic_result(x);
722  argy = theta;
723 }
724 
725 template<typename IntType, uint32_t IntBits>
727 {
729 
730  if (x < 0) {
732  }
733 
734  bool negate_cos = false;
735  bool negate_sin = false;
736 
738  {
740  negate_sin=true;
741  }
742 
744  {
746  negate_cos=true;
747  }
748 
750 
751  perform_cordic_rotation(x_cos, x_sin, (int64_t) x);
752 
753  if (s) {
754  s->m_nVal = negate_sin ? -x_sin : x_sin;
755  }
756 
757  if(c) {
758  c->m_nVal = negate_cos ? -x_cos : x_cos;
759  }
760 }
761 
762 template<typename IntType, uint32_t IntBits>
764 {
765  Fixed<IntType, IntBits> r, theta;
766  to_polar(1, *this, &r, &theta);
767  return theta;
768 }
769 
770 template<typename IntType, uint32_t IntBits>
772 {
773  bool const negative_x = x.m_nVal < 0;
774  bool const negative_y = y.m_nVal < 0;
775 
776  uint64_t a = negative_x ? -x.m_nVal : x.m_nVal;
777  uint64_t b = negative_y ? -y.m_nVal : y.m_nVal;
778 
779  unsigned int right_shift = 0;
780  unsigned const max_value = 1U << FixedTraits<IntBits>::fixed_resolution_shift;
781 
782  while ((a >= max_value) || (b >= max_value))
783  {
784  ++right_shift;
785  a >>= 1;
786  b >>= 1;
787  }
788 
789  int64_t xtemp = (int64_t) a;
790  int64_t ytemp = (int64_t) b;
791 
792  perform_cordic_polarization(xtemp, ytemp);
793 
794  r->m_nVal = int64_t(xtemp) << right_shift;
795  theta->m_nVal = ytemp;
796 
797  if (negative_x && negative_y) {
799  } else if (negative_x) {
801  }
802 
803  else if(negative_y) {
804  theta->m_nVal = -theta->m_nVal;
805  }
806 }
807 
808 template<typename IntType, uint32_t IntBits>
810 {
811  Fixed<IntType, IntBits> temp(a);
812  return temp -= b;
813 }
814 
815 
816 template<typename IntType, uint32_t IntBits>
818 {
819  Fixed<IntType, IntBits> temp(a);
820  return temp -= b;
821 }
822 
823 template<typename IntType, uint32_t IntBits>
825 {
826  Fixed<IntType, IntBits> temp(a);
827  return temp -= b;
828 }
829 
830 template<typename IntType, uint32_t IntBits>
832 {
833  Fixed<IntType, IntBits> temp(a);
834  return temp -= b;
835 }
836 
837 template<typename IntType, uint32_t IntBits>
839 {
840  Fixed<IntType, IntBits> temp(a);
841  return temp -= b;
842 }
843 
844 template<typename IntType, uint32_t IntBits>
846 {
847  Fixed<IntType, IntBits> temp(a);
848  return temp -= b;
849 }
850 
851 template<typename IntType, uint32_t IntBits>
853 {
854  Fixed<IntType, IntBits> temp(a);
855  return temp -= b;
856 }
857 
858 template<typename IntType, uint32_t IntBits>
860 {
861  Fixed<IntType, IntBits> temp(a);
862  return temp -= b;
863 }
864 
865 template<typename IntType, uint32_t IntBits>
867 {
868  Fixed<IntType, IntBits> temp(a);
869  return temp -= b;
870 }
871 
872 template<typename IntType, uint32_t IntBits>
874 {
875  Fixed<IntType, IntBits> temp(a);
876  return temp -= b;
877 }
878 
879 template<typename IntType, uint32_t IntBits>
881 {
882  Fixed<IntType, IntBits> temp(a);
883  return temp -= b;
884 }
885 
886 template<typename IntType, uint32_t IntBits>
888 {
889  Fixed<IntType, IntBits> temp(a);
890  return temp -= b;
891 }
892 
893 template<typename IntType, uint32_t IntBits>
895 {
896  Fixed<IntType, IntBits> temp(a);
897  return temp -= b;
898 }
899 
900 template<typename IntType, uint32_t IntBits>
902 {
903  Fixed<IntType, IntBits> temp(a);
904  return temp -= b;
905 }
906 
907 template<typename IntType, uint32_t IntBits>
909 {
910  Fixed<IntType, IntBits> temp(a);
911  return temp -= b;
912 }
913 
914 template<typename IntType, uint32_t IntBits>
916 {
917  Fixed<IntType, IntBits> temp(a);
918  return temp -= b;
919 }
920 
921 template<typename IntType, uint32_t IntBits>
923 {
924  Fixed<IntType, IntBits> temp(a);
925  return temp -= b;
926 }
927 
928 template<typename IntType, uint32_t IntBits>
930 {
931  Fixed<IntType, IntBits> temp(a);
932  return temp -= b;
933 }
934 
935 template<typename IntType, uint32_t IntBits>
937 {
938  Fixed<IntType, IntBits> temp(a);
939  return temp -= b;
940 }
941 
942 template<typename IntType, uint32_t IntBits>
944 {
945  Fixed<IntType, IntBits> temp(a);
946  return temp -= b;
947 }
948 
949 template<typename IntType, uint32_t IntBits>
951 {
952  Fixed<IntType, IntBits> temp(a);
953  return temp -= b;
954 }
955 
956 template<typename IntType, uint32_t IntBits>
958 {
959  Fixed<IntType, IntBits> temp(a);
960  return temp %= b;
961 }
962 
963 template<typename IntType, uint32_t IntBits>
965 {
966  Fixed<IntType, IntBits> temp(a);
967  return temp %= b;
968 }
969 
970 template<typename IntType, uint32_t IntBits>
972 {
973  Fixed<IntType, IntBits> temp(a);
974  return temp %= b;
975 }
976 
977 template<typename IntType, uint32_t IntBits>
979 {
980  Fixed<IntType, IntBits> temp(a);
981  return temp %= b;
982 }
983 
984 template<typename IntType, uint32_t IntBits>
986 {
987  Fixed<IntType, IntBits> temp(a);
988  return temp %= b;
989 }
990 
991 template<typename IntType, uint32_t IntBits>
993 {
994  Fixed<IntType, IntBits> temp(a);
995  return temp %= b;
996 }
997 
998 template<typename IntType, uint32_t IntBits>
1000 {
1001  Fixed<IntType, IntBits> temp(a);
1002  return temp %= b;
1003 }
1004 
1005 template<typename IntType, uint32_t IntBits>
1007 {
1008  Fixed<IntType, IntBits> temp(a);
1009  return temp %= b;
1010 }
1011 
1012 template<typename IntType, uint32_t IntBits>
1014 {
1015  Fixed<IntType, IntBits> temp(a);
1016  return temp %= b;
1017 }
1018 
1019 template<typename IntType, uint32_t IntBits>
1021 {
1022  Fixed<IntType, IntBits> temp(a);
1023  return temp %= b;
1024 }
1025 
1026 template<typename IntType, uint32_t IntBits>
1028 {
1029  Fixed<IntType, IntBits> temp(a);
1030  return temp %= b;
1031 }
1032 
1033 template<typename IntType, uint32_t IntBits>
1035 {
1036  Fixed<IntType, IntBits> temp(a);
1037  return temp %= b;
1038 }
1039 
1040 template<typename IntType, uint32_t IntBits>
1042 {
1043  Fixed<IntType, IntBits> temp(a);
1044  return temp %= b;
1045 }
1046 
1047 template<typename IntType, uint32_t IntBits>
1049 {
1050  Fixed<IntType, IntBits> temp(a);
1051  return temp %= b;
1052 }
1053 
1054 template<typename IntType, uint32_t IntBits>
1056 {
1057  Fixed<IntType, IntBits> temp(a);
1058  return temp %= b;
1059 }
1060 
1061 template<typename IntType, uint32_t IntBits>
1063 {
1064  Fixed<IntType, IntBits> temp(a);
1065  return temp %= b;
1066 }
1067 
1068 template<typename IntType, uint32_t IntBits>
1070 {
1071  Fixed<IntType, IntBits> temp(a);
1072  return temp %= b;
1073 }
1074 
1075 template<typename IntType, uint32_t IntBits>
1077 {
1078  Fixed<IntType, IntBits> temp(a);
1079  return temp %= b;
1080 }
1081 
1082 template<typename IntType, uint32_t IntBits>
1084 {
1085  Fixed<IntType, IntBits> temp(a);
1086  return temp %= b;
1087 }
1088 
1089 template<typename IntType, uint32_t IntBits>
1091 {
1092  Fixed<IntType, IntBits> temp(a);
1093  return temp %= b;
1094 }
1095 
1096 template<typename IntType, uint32_t IntBits>
1098 {
1099  Fixed<IntType, IntBits> temp(a);
1100  return temp %= b;
1101 }
1102 
1103 template<typename IntType, uint32_t IntBits>
1105 {
1106  Fixed<IntType, IntBits> temp(a);
1107  return temp += b;
1108 }
1109 
1110 template<typename IntType, uint32_t IntBits>
1112 {
1113  Fixed<IntType, IntBits> temp(a);
1114  return temp += b;
1115 }
1116 
1117 template<typename IntType, uint32_t IntBits>
1119 {
1120  Fixed<IntType, IntBits> temp(a);
1121  return temp += b;
1122 }
1123 
1124 template<typename IntType, uint32_t IntBits>
1126 {
1127  Fixed<IntType, IntBits> temp(a);
1128  return temp += b;
1129 }
1130 
1131 template<typename IntType, uint32_t IntBits>
1133 {
1134  Fixed<IntType, IntBits> temp(a);
1135  return temp += b;
1136 }
1137 
1138 template<typename IntType, uint32_t IntBits>
1140 {
1141  Fixed<IntType, IntBits> temp(a);
1142  return temp += b;
1143 }
1144 
1145 template<typename IntType, uint32_t IntBits>
1147 {
1148  Fixed<IntType, IntBits> temp(a);
1149  return temp += b;
1150 }
1151 
1152 template<typename IntType, uint32_t IntBits>
1154 {
1155  Fixed<IntType, IntBits> temp(a);
1156  return temp += b;
1157 }
1158 
1159 template<typename IntType, uint32_t IntBits>
1161 {
1162  Fixed<IntType, IntBits> temp(a);
1163  return temp += b;
1164 }
1165 
1166 template<typename IntType, uint32_t IntBits>
1168 {
1169  Fixed<IntType, IntBits> temp(a);
1170  return temp += b;
1171 }
1172 
1173 template<typename IntType, uint32_t IntBits>
1175 {
1176  Fixed<IntType, IntBits> temp(a);
1177  return temp += b;
1178 }
1179 
1180 template<typename IntType, uint32_t IntBits>
1182 {
1183  Fixed<IntType, IntBits> temp(a);
1184  return temp += b;
1185 }
1186 
1187 template<typename IntType, uint32_t IntBits>
1189 {
1190  Fixed<IntType, IntBits> temp(a);
1191  return temp += b;
1192 }
1193 
1194 template<typename IntType, uint32_t IntBits>
1196 {
1197  Fixed<IntType, IntBits> temp(a);
1198  return temp += b;
1199 }
1200 
1201 template<typename IntType, uint32_t IntBits>
1203 {
1204  Fixed<IntType, IntBits> temp(a);
1205  return temp += b;
1206 }
1207 
1208 template<typename IntType, uint32_t IntBits>
1210 {
1211  Fixed<IntType, IntBits> temp(a);
1212  return temp += b;
1213 }
1214 
1215 template<typename IntType, uint32_t IntBits>
1217 {
1218  Fixed<IntType, IntBits> temp(a);
1219  return temp += b;
1220 }
1221 
1222 template<typename IntType, uint32_t IntBits>
1224 {
1225  Fixed<IntType, IntBits> temp(a);
1226  return temp += b;
1227 }
1228 
1229 template<typename IntType, uint32_t IntBits>
1231 {
1232  Fixed<IntType, IntBits> temp(a);
1233  return temp += b;
1234 }
1235 
1236 template<typename IntType, uint32_t IntBits>
1238 {
1239  Fixed<IntType, IntBits> temp(a);
1240  return temp += b;
1241 }
1242 
1243 template<typename IntType, uint32_t IntBits>
1245 {
1246  Fixed<IntType, IntBits> temp(a);
1247  return temp += b;
1248 }
1249 
1250 template<typename IntType, uint32_t IntBits>
1252 {
1253  Fixed<IntType, IntBits> temp(b);
1254  return temp *= a;
1255 }
1256 
1257 template<typename IntType, uint32_t IntBits>
1259 {
1260  Fixed<IntType, IntBits> temp(b);
1261  return temp *= a;
1262 }
1263 
1264 template<typename IntType, uint32_t IntBits>
1266 {
1267  Fixed<IntType, IntBits> temp(b);
1268  return temp *= a;
1269 }
1270 
1271 template<typename IntType, uint32_t IntBits>
1273 {
1274  Fixed<IntType, IntBits> temp(b);
1275  return temp *= a;
1276 }
1277 
1278 template<typename IntType, uint32_t IntBits>
1280 {
1281  Fixed<IntType, IntBits> temp(b);
1282  return temp *= a;
1283 }
1284 
1285 template<typename IntType, uint32_t IntBits>
1287 {
1288  Fixed<IntType, IntBits> temp(b);
1289  return temp *= a;
1290 }
1291 
1292 template<typename IntType, uint32_t IntBits>
1294 {
1295  Fixed<IntType, IntBits> temp(b);
1296  return temp *= a;
1297 }
1298 
1299 template<typename IntType, uint32_t IntBits>
1301 {
1302  Fixed<IntType, IntBits> temp(b);
1303  return temp *= a;
1304 }
1305 
1306 template<typename IntType, uint32_t IntBits>
1308 {
1309  Fixed<IntType, IntBits> temp(b);
1310  return temp *= a;
1311 }
1312 
1313 template<typename IntType, uint32_t IntBits>
1315 {
1316  Fixed<IntType, IntBits> temp(b);
1317  return temp *= a;
1318 }
1319 
1320 template<typename IntType, uint32_t IntBits>
1322 {
1323  Fixed<IntType, IntBits> temp(a);
1324  return temp *= b;
1325 }
1326 
1327 template<typename IntType, uint32_t IntBits>
1329 {
1330  Fixed<IntType, IntBits> temp(a);
1331  return temp *= b;
1332 }
1333 
1334 template<typename IntType, uint32_t IntBits>
1336 {
1337  Fixed<IntType, IntBits> temp(a);
1338  return temp *= b;
1339 }
1340 
1341 template<typename IntType, uint32_t IntBits>
1343 {
1344  Fixed<IntType, IntBits> temp(a);
1345  return temp *= b;
1346 }
1347 
1348 template<typename IntType, uint32_t IntBits>
1350 {
1351  Fixed<IntType, IntBits> temp(a);
1352  return temp *= b;
1353 }
1354 
1355 template<typename IntType, uint32_t IntBits>
1357 {
1358  Fixed<IntType, IntBits> temp(a);
1359  return temp *= b;
1360 }
1361 
1362 template<typename IntType, uint32_t IntBits>
1364 {
1365  Fixed<IntType, IntBits> temp(a);
1366  return temp *= b;
1367 }
1368 
1369 template<typename IntType, uint32_t IntBits>
1371 {
1372  Fixed<IntType, IntBits> temp(a);
1373  return temp *= b;
1374 }
1375 
1376 template<typename IntType, uint32_t IntBits>
1378 {
1379  Fixed<IntType, IntBits> temp(a);
1380  return temp *= b;
1381 }
1382 
1383 template<typename IntType, uint32_t IntBits>
1385 {
1386  Fixed<IntType, IntBits> temp(a);
1387  return temp *= b;
1388 }
1389 
1390 template<typename IntType, uint32_t IntBits>
1392 {
1393  Fixed<IntType, IntBits> temp(a);
1394  return temp *= b;
1395 }
1396 
1397 template<typename IntType, uint32_t IntBits>
1399 {
1400  Fixed<IntType, IntBits> temp(a);
1401  return temp /= b;
1402 }
1403 
1404 template<typename IntType, uint32_t IntBits>
1406 {
1407  Fixed<IntType, IntBits> temp(a);
1408  return temp /= b;
1409 }
1410 
1411 template<typename IntType, uint32_t IntBits>
1413 {
1414  Fixed<IntType, IntBits> temp(a);
1415  return temp /= b;
1416 }
1417 
1418 template<typename IntType, uint32_t IntBits>
1420 {
1421  Fixed<IntType, IntBits> temp(a);
1422  return temp /= b;
1423 }
1424 
1425 template<typename IntType, uint32_t IntBits>
1427 {
1428  Fixed<IntType, IntBits> temp(a);
1429  return temp /= b;
1430 }
1431 
1432 template<typename IntType, uint32_t IntBits>
1434 {
1435  Fixed<IntType, IntBits> temp(a);
1436  return temp /= b;
1437 }
1438 
1439 template<typename IntType, uint32_t IntBits>
1441 {
1442  Fixed<IntType, IntBits> temp(a);
1443  return temp /= b;
1444 }
1445 
1446 template<typename IntType, uint32_t IntBits>
1448 {
1449  Fixed<IntType, IntBits> temp(a);
1450  return temp /= b;
1451 }
1452 
1453 template<typename IntType, uint32_t IntBits>
1455 {
1456  Fixed<IntType, IntBits> temp(a);
1457  return temp /= b;
1458 }
1459 
1460 template<typename IntType, uint32_t IntBits>
1462 {
1463  Fixed<IntType, IntBits> temp(a);
1464  return temp /= b;
1465 }
1466 
1467 template<typename IntType, uint32_t IntBits>
1469 {
1470  Fixed<IntType, IntBits> temp(a);
1471  return temp /= b;
1472 }
1473 
1474 template<typename IntType, uint32_t IntBits>
1476 {
1477  Fixed<IntType, IntBits> temp(a);
1478  return temp /= b;
1479 }
1480 
1481 template<typename IntType, uint32_t IntBits>
1483 {
1484  Fixed<IntType, IntBits> temp(a);
1485  return temp /= b;
1486 }
1487 
1488 template<typename IntType, uint32_t IntBits>
1490 {
1491  Fixed<IntType, IntBits> temp(a);
1492  return temp /= b;
1493 }
1494 
1495 template<typename IntType, uint32_t IntBits>
1497 {
1498  Fixed<IntType, IntBits> temp(a);
1499  return temp /= b;
1500 }
1501 
1502 template<typename IntType, uint32_t IntBits>
1504 {
1505  Fixed<IntType, IntBits> temp(a);
1506  return temp /= b;
1507 }
1508 
1509 template<typename IntType, uint32_t IntBits>
1511 {
1512  Fixed<IntType, IntBits> temp(a);
1513  return temp /= b;
1514 }
1515 
1516 template<typename IntType, uint32_t IntBits>
1518 {
1519  Fixed<IntType, IntBits> temp(a);
1520  return temp /= b;
1521 }
1522 
1523 template<typename IntType, uint32_t IntBits>
1525 {
1526  Fixed<IntType, IntBits> temp(a);
1527  return temp /= b;
1528 }
1529 
1530 template<typename IntType, uint32_t IntBits>
1532 {
1533  Fixed<IntType, IntBits> temp(a);
1534  return temp /= b;
1535 }
1536 
1537 template<typename IntType, uint32_t IntBits>
1539 {
1540  Fixed<IntType, IntBits> temp(a);
1541  return temp /= b;
1542 }
1543 
1544 template<typename IntType, uint32_t IntBits>
1545 inline bool operator==(double a, Fixed<IntType, IntBits> const& b)
1546 {
1547  return Fixed<IntType, IntBits>(a) == b;
1548 }
1549 
1550 template<typename IntType, uint32_t IntBits>
1551 inline bool operator==(float a, Fixed<IntType, IntBits> const& b)
1552 {
1553  return Fixed<IntType, IntBits>(a) == b;
1554 }
1555 
1556 template<typename IntType, uint32_t IntBits>
1558 {
1559  return Fixed<IntType, IntBits>(a) == b;
1560 }
1561 
1562 template<typename IntType, uint32_t IntBits>
1564 {
1565  return Fixed<IntType, IntBits>(a) == b;
1566 }
1567 
1568 template<typename IntType, uint32_t IntBits>
1569 inline bool operator==(unsigned a, Fixed<IntType, IntBits> const& b)
1570 {
1571  return Fixed<IntType, IntBits>(a) == b;
1572 }
1573 
1574 template<typename IntType, uint32_t IntBits>
1575 inline bool operator==(int a, Fixed<IntType, IntBits> const& b)
1576 {
1577  return Fixed<IntType, IntBits>(a) == b;
1578 }
1579 
1580 template<typename IntType, uint32_t IntBits>
1581 inline bool operator==(unsigned short a, Fixed<IntType, IntBits> const& b)
1582 {
1583  return Fixed<IntType, IntBits>(a) == b;
1584 }
1585 
1586 template<typename IntType, uint32_t IntBits>
1587 inline bool operator==(short a, Fixed<IntType, IntBits> const& b)
1588 {
1589  return Fixed<IntType, IntBits>(a) == b;
1590 }
1591 
1592 template<typename IntType, uint32_t IntBits>
1593 inline bool operator==(unsigned char a, Fixed<IntType, IntBits> const& b)
1594 {
1595  return Fixed<IntType, IntBits>(a) == b;
1596 }
1597 
1598 template<typename IntType, uint32_t IntBits>
1599 inline bool operator==(char a, Fixed<IntType, IntBits> const& b)
1600 {
1601  return Fixed<IntType, IntBits>(a) == b;
1602 }
1603 
1604 template<typename IntType, uint32_t IntBits>
1605 inline bool operator==(Fixed<IntType, IntBits> const& a, double b)
1606 {
1607  return a == Fixed<IntType, IntBits>(b);
1608 }
1609 
1610 template<typename IntType, uint32_t IntBits>
1611 inline bool operator==(Fixed<IntType, IntBits> const& a, float b)
1612 {
1613  return a == Fixed<IntType, IntBits>(b);
1614 }
1615 
1616 template<typename IntType, uint32_t IntBits>
1618 {
1619  return a == Fixed<IntType, IntBits>(b);
1620 }
1621 
1622 template<typename IntType, uint32_t IntBits>
1624 {
1625  return a == Fixed<IntType, IntBits>(b);
1626 }
1627 
1628 template<typename IntType, uint32_t IntBits>
1629 inline bool operator==(Fixed<IntType, IntBits> const& a, unsigned b)
1630 {
1631  return a == Fixed<IntType, IntBits>(b);
1632 }
1633 
1634 template<typename IntType, uint32_t IntBits>
1635 inline bool operator==(Fixed<IntType, IntBits> const& a, int b)
1636 {
1637  return a == Fixed<IntType, IntBits>(b);
1638 }
1639 
1640 template<typename IntType, uint32_t IntBits>
1641 inline bool operator==(Fixed<IntType, IntBits> const& a, unsigned short b)
1642 {
1643  return a == Fixed<IntType, IntBits>(b);
1644 }
1645 
1646 template<typename IntType, uint32_t IntBits>
1647 inline bool operator==(Fixed<IntType, IntBits> const& a, short b)
1648 {
1649  return a == Fixed<IntType, IntBits>(b);
1650 }
1651 
1652 template<typename IntType, uint32_t IntBits>
1653 inline bool operator==(Fixed<IntType, IntBits> const& a, unsigned char b)
1654 {
1655  return a == Fixed<IntType, IntBits>(b);
1656 }
1657 
1658 template<typename IntType, uint32_t IntBits>
1659 inline bool operator==(Fixed<IntType, IntBits> const& a, char b)
1660 {
1661  return a == Fixed<IntType, IntBits>(b);
1662 }
1663 
1664 template<typename IntType, uint32_t IntBits>
1665 inline bool operator!=(double a, Fixed<IntType, IntBits> const& b)
1666 {
1667  return Fixed<IntType, IntBits>(a) != b;
1668 }
1669 
1670 template<typename IntType, uint32_t IntBits>
1671 inline bool operator!=(float a, Fixed<IntType, IntBits> const& b)
1672 {
1673  return Fixed<IntType, IntBits>(a) != b;
1674 }
1675 
1676 template<typename IntType, uint32_t IntBits>
1678 {
1679  return Fixed<IntType, IntBits>(a) != b;
1680 }
1681 
1682 template<typename IntType, uint32_t IntBits>
1684 {
1685  return Fixed<IntType, IntBits>(a) != b;
1686 }
1687 
1688 template<typename IntType, uint32_t IntBits>
1689 inline bool operator!=(unsigned a, Fixed<IntType, IntBits> const& b)
1690 {
1691  return Fixed<IntType, IntBits>(a) != b;
1692 }
1693 
1694 template<typename IntType, uint32_t IntBits>
1695 inline bool operator!=(int a, Fixed<IntType, IntBits> const& b)
1696 {
1697  return Fixed<IntType, IntBits>(a) != b;
1698 }
1699 
1700 template<typename IntType, uint32_t IntBits>
1701 inline bool operator!=(unsigned short a, Fixed<IntType, IntBits> const& b)
1702 {
1703  return Fixed<IntType, IntBits>(a) != b;
1704 }
1705 
1706 template<typename IntType, uint32_t IntBits>
1707 inline bool operator!=(short a, Fixed<IntType, IntBits> const& b)
1708 {
1709  return Fixed<IntType, IntBits>(a) != b;
1710 }
1711 
1712 template<typename IntType, uint32_t IntBits>
1713 inline bool operator!=(unsigned char a, Fixed<IntType, IntBits> const& b)
1714 {
1715  return Fixed<IntType, IntBits>(a) != b;
1716 }
1717 
1718 template<typename IntType, uint32_t IntBits>
1719 inline bool operator!=(char a, Fixed<IntType, IntBits> const& b)
1720 {
1721  return Fixed<IntType, IntBits>(a) != b;
1722 }
1723 
1724 template<typename IntType, uint32_t IntBits>
1725 inline bool operator!=(Fixed<IntType, IntBits> const& a, double b)
1726 {
1727  return a != Fixed<IntType, IntBits>(b);
1728 }
1729 
1730 template<typename IntType, uint32_t IntBits>
1731 inline bool operator!=(Fixed<IntType, IntBits> const& a, float b)
1732 {
1733  return a != Fixed<IntType, IntBits>(b);
1734 }
1735 
1736 template<typename IntType, uint32_t IntBits>
1738 {
1739  return a != Fixed<IntType, IntBits>(b);
1740 }
1741 
1742 template<typename IntType, uint32_t IntBits>
1744 {
1745  return a != Fixed<IntType, IntBits>(b);
1746 }
1747 
1748 template<typename IntType, uint32_t IntBits>
1749 inline bool operator!=(Fixed<IntType, IntBits> const& a, unsigned b)
1750 {
1751  return a != Fixed<IntType, IntBits>(b);
1752 }
1753 
1754 template<typename IntType, uint32_t IntBits>
1755 inline bool operator!=(Fixed<IntType, IntBits> const& a, int b)
1756 {
1757  return a != Fixed<IntType, IntBits>(b);
1758 }
1759 
1760 template<typename IntType, uint32_t IntBits>
1761 inline bool operator!=(Fixed<IntType, IntBits> const& a, unsigned short b)
1762 {
1763  return a != Fixed<IntType, IntBits>(b);
1764 }
1765 
1766 template<typename IntType, uint32_t IntBits>
1767 inline bool operator!=(Fixed<IntType, IntBits> const& a, short b)
1768 {
1769  return a != Fixed<IntType, IntBits>(b);
1770 }
1771 
1772 template<typename IntType, uint32_t IntBits>
1773 inline bool operator!=(Fixed<IntType, IntBits> const& a, unsigned char b)
1774 {
1775  return a != Fixed<IntType, IntBits>(b);
1776 }
1777 
1778 template<typename IntType, uint32_t IntBits>
1779 inline bool operator!=(Fixed<IntType, IntBits> const& a, char b)
1780 {
1781  return a != Fixed<IntType, IntBits>(b);
1782 }
1783 
1784 template<typename IntType, uint32_t IntBits>
1785 inline bool operator<(double a, Fixed<IntType, IntBits> const& b)
1786 {
1787  return Fixed<IntType, IntBits>(a) < b;
1788 }
1789 
1790 template<typename IntType, uint32_t IntBits>
1791 inline bool operator<(float a, Fixed<IntType, IntBits> const& b)
1792 {
1793  return Fixed<IntType, IntBits>(a) < b;
1794 }
1795 
1796 template<typename IntType, uint32_t IntBits>
1797 inline bool operator<(uint64_t a, Fixed<IntType, IntBits> const& b)
1798 {
1799  return Fixed<IntType, IntBits>(a) < b;
1800 }
1801 
1802 template<typename IntType, uint32_t IntBits>
1803 inline bool operator<(int64_t a, Fixed<IntType, IntBits> const& b)
1804 {
1805  return Fixed<IntType, IntBits>(a) < b;
1806 }
1807 
1808 template<typename IntType, uint32_t IntBits>
1809 inline bool operator<(unsigned a, Fixed<IntType, IntBits> const& b)
1810 {
1811  return Fixed<IntType, IntBits>(a) < b;
1812 }
1813 
1814 template<typename IntType, uint32_t IntBits>
1815 inline bool operator<(int a, Fixed<IntType, IntBits> const& b)
1816 {
1817  return Fixed<IntType, IntBits>(a) < b;
1818 }
1819 
1820 template<typename IntType, uint32_t IntBits>
1821 inline bool operator<(unsigned short a, Fixed<IntType, IntBits> const& b)
1822 {
1823  return Fixed<IntType, IntBits>(a) < b;
1824 }
1825 
1826 template<typename IntType, uint32_t IntBits>
1827 inline bool operator<(short a, Fixed<IntType, IntBits> const& b)
1828 {
1829  return Fixed<IntType, IntBits>(a) < b;
1830 }
1831 
1832 template<typename IntType, uint32_t IntBits>
1833 inline bool operator<(unsigned char a, Fixed<IntType, IntBits> const& b)
1834 {
1835  return Fixed<IntType, IntBits>(a) < b;
1836 }
1837 
1838 template<typename IntType, uint32_t IntBits>
1839 inline bool operator<(char a, Fixed<IntType, IntBits> const& b)
1840 {
1841  return Fixed<IntType, IntBits>(a) < b;
1842 }
1843 
1844 template<typename IntType, uint32_t IntBits>
1845 inline bool operator<(Fixed<IntType, IntBits> const& a, double b)
1846 {
1847  return a < Fixed<IntType, IntBits>(b);
1848 }
1849 
1850 template<typename IntType, uint32_t IntBits>
1851 inline bool operator<(Fixed<IntType, IntBits> const& a, float b)
1852 {
1853  return a < Fixed<IntType, IntBits>(b);
1854 }
1855 
1856 template<typename IntType, uint32_t IntBits>
1857 inline bool operator<(Fixed<IntType, IntBits> const& a, uint64_t b)
1858 {
1859  return a < Fixed<IntType, IntBits>(b);
1860 }
1861 
1862 template<typename IntType, uint32_t IntBits>
1863 inline bool operator<(Fixed<IntType, IntBits> const& a, int64_t b)
1864 {
1865  return a < Fixed<IntType, IntBits>(b);
1866 }
1867 
1868 template<typename IntType, uint32_t IntBits>
1869 inline bool operator<(Fixed<IntType, IntBits> const& a, unsigned b)
1870 {
1871  return a < Fixed<IntType, IntBits>(b);
1872 }
1873 
1874 template<typename IntType, uint32_t IntBits>
1875 inline bool operator<(Fixed<IntType, IntBits> const& a, int b)
1876 {
1877  return a < Fixed<IntType, IntBits>(b);
1878 }
1879 
1880 template<typename IntType, uint32_t IntBits>
1881 inline bool operator<(Fixed<IntType, IntBits> const& a, unsigned short b)
1882 {
1883  return a < Fixed<IntType, IntBits>(b);
1884 }
1885 
1886 template<typename IntType, uint32_t IntBits>
1887 inline bool operator<(Fixed<IntType, IntBits> const& a, short b)
1888 {
1889  return a < Fixed<IntType, IntBits>(b);
1890 }
1891 
1892 template<typename IntType, uint32_t IntBits>
1893 inline bool operator<(Fixed<IntType, IntBits> const& a, unsigned char b)
1894 {
1895  return a < Fixed<IntType, IntBits>(b);
1896 }
1897 
1898 template<typename IntType, uint32_t IntBits>
1899 inline bool operator<(Fixed<IntType, IntBits> const& a, char b)
1900 {
1901  return a < Fixed<IntType, IntBits>(b);
1902 }
1903 
1904 template<typename IntType, uint32_t IntBits>
1905 inline bool operator>(double a, Fixed<IntType, IntBits> const& b)
1906 {
1907  return Fixed<IntType, IntBits>(a) > b;
1908 }
1909 
1910 template<typename IntType, uint32_t IntBits>
1911 inline bool operator>(float a, Fixed<IntType, IntBits> const& b)
1912 {
1913  return Fixed<IntType, IntBits>(a) > b;
1914 }
1915 
1916 template<typename IntType, uint32_t IntBits>
1918 {
1919  return Fixed<IntType, IntBits>(a) > b;
1920 }
1921 
1922 template<typename IntType, uint32_t IntBits>
1924 {
1925  return Fixed<IntType, IntBits>(a) > b;
1926 }
1927 
1928 template<typename IntType, uint32_t IntBits>
1929 inline bool operator>(unsigned a, Fixed<IntType, IntBits> const& b)
1930 {
1931  return Fixed<IntType, IntBits>(a) > b;
1932 }
1933 
1934 template<typename IntType, uint32_t IntBits>
1935 inline bool operator>(int a, Fixed<IntType, IntBits> const& b)
1936 {
1937  return Fixed<IntType, IntBits>(a) > b;
1938 }
1939 
1940 template<typename IntType, uint32_t IntBits>
1941 inline bool operator>(unsigned short a, Fixed<IntType, IntBits> const& b)
1942 {
1943  return Fixed<IntType, IntBits>(a) > b;
1944 }
1945 
1946 template<typename IntType, uint32_t IntBits>
1947 inline bool operator>(short a, Fixed<IntType, IntBits> const& b)
1948 {
1949  return Fixed<IntType, IntBits>(a) > b;
1950 }
1951 
1952 template<typename IntType, uint32_t IntBits>
1953 inline bool operator>(unsigned char a, Fixed<IntType, IntBits> const& b)
1954 {
1955  return Fixed<IntType, IntBits>(a) > b;
1956 }
1957 
1958 template<typename IntType, uint32_t IntBits>
1959 inline bool operator>(char a, Fixed<IntType, IntBits> const& b)
1960 {
1961  return Fixed<IntType, IntBits>(a) > b;
1962 }
1963 
1964 template<typename IntType, uint32_t IntBits>
1965 inline bool operator>(Fixed<IntType, IntBits> const& a, double b)
1966 {
1967  return a > Fixed<IntType, IntBits>(b);
1968 }
1969 
1970 template<typename IntType, uint32_t IntBits>
1971 inline bool operator>(Fixed<IntType, IntBits> const& a, float b)
1972 {
1973  return a > Fixed<IntType, IntBits>(b);
1974 }
1975 
1976 template<typename IntType, uint32_t IntBits>
1978 {
1979  return a > Fixed<IntType, IntBits>(b);
1980 }
1981 
1982 template<typename IntType, uint32_t IntBits>
1984 {
1985  return a > Fixed<IntType, IntBits>(b);
1986 }
1987 
1988 template<typename IntType, uint32_t IntBits>
1989 inline bool operator>(Fixed<IntType, IntBits> const& a, unsigned b)
1990 {
1991  return a > Fixed<IntType, IntBits>(b);
1992 }
1993 
1994 template<typename IntType, uint32_t IntBits>
1995 inline bool operator>(Fixed<IntType, IntBits> const& a, int b)
1996 {
1997  return a > Fixed<IntType, IntBits>(b);
1998 }
1999 
2000 template<typename IntType, uint32_t IntBits>
2001 inline bool operator>(Fixed<IntType, IntBits> const& a, unsigned short b)
2002 {
2003  return a > Fixed<IntType, IntBits>(b);
2004 }
2005 
2006 template<typename IntType, uint32_t IntBits>
2007 inline bool operator>(Fixed<IntType, IntBits> const& a, short b)
2008 {
2009  return a > Fixed<IntType, IntBits>(b);
2010 }
2011 
2012 template<typename IntType, uint32_t IntBits>
2013 inline bool operator>(Fixed<IntType, IntBits> const& a, unsigned char b)
2014 {
2015  return a > Fixed<IntType, IntBits>(b);
2016 }
2017 
2018 template<typename IntType, uint32_t IntBits>
2019 inline bool operator>(Fixed<IntType, IntBits> const& a, char b)
2020 {
2021  return a > Fixed<IntType, IntBits>(b);
2022 }
2023 
2024 template<typename IntType, uint32_t IntBits>
2025 inline bool operator<=(double a, Fixed<IntType, IntBits> const& b)
2026 {
2027  return Fixed<IntType, IntBits>(a) <= b;
2028 }
2029 
2030 template<typename IntType, uint32_t IntBits>
2031 inline bool operator<=(float a, Fixed<IntType, IntBits> const& b)
2032 {
2033  return Fixed<IntType, IntBits>(a) <= b;
2034 }
2035 
2036 template<typename IntType, uint32_t IntBits>
2037 inline bool operator<=(uint64_t a, Fixed<IntType, IntBits> const& b)
2038 {
2039  return Fixed<IntType, IntBits>(a) <= b;
2040 }
2041 
2042 template<typename IntType, uint32_t IntBits>
2043 inline bool operator<=(int64_t a, Fixed<IntType, IntBits> const& b)
2044 {
2045  return Fixed<IntType, IntBits>(a) <= b;
2046 }
2047 
2048 template<typename IntType, uint32_t IntBits>
2049 inline bool operator<=(unsigned a, Fixed<IntType, IntBits> const& b)
2050 {
2051  return Fixed<IntType, IntBits>(a) <= b;
2052 }
2053 
2054 template<typename IntType, uint32_t IntBits>
2055 inline bool operator<=(int a, Fixed<IntType, IntBits> const& b)
2056 {
2057  return Fixed<IntType, IntBits>(a) <= b;
2058 }
2059 
2060 template<typename IntType, uint32_t IntBits>
2061 inline bool operator<=(unsigned short a, Fixed<IntType, IntBits> const& b)
2062 {
2063  return Fixed<IntType, IntBits>(a) <= b;
2064 }
2065 
2066 template<typename IntType, uint32_t IntBits>
2067 inline bool operator<=(short a, Fixed<IntType, IntBits> const& b)
2068 {
2069  return Fixed<IntType, IntBits>(a) <= b;
2070 }
2071 
2072 template<typename IntType, uint32_t IntBits>
2073 inline bool operator<=(unsigned char a, Fixed<IntType, IntBits> const& b)
2074 {
2075  return Fixed<IntType, IntBits>(a) <= b;
2076 }
2077 
2078 template<typename IntType, uint32_t IntBits>
2079 inline bool operator<=(char a, Fixed<IntType, IntBits> const& b)
2080 {
2081  return Fixed<IntType, IntBits>(a) <= b;
2082 }
2083 
2084 template<typename IntType, uint32_t IntBits>
2085 inline bool operator<=(Fixed<IntType, IntBits> const& a, double b)
2086 {
2087  return a <= Fixed<IntType, IntBits>(b);
2088 }
2089 
2090 template<typename IntType, uint32_t IntBits>
2091 inline bool operator<=(Fixed<IntType, IntBits> const& a, float b)
2092 {
2093  return a <= Fixed<IntType, IntBits>(b);
2094 }
2095 
2096 template<typename IntType, uint32_t IntBits>
2097 inline bool operator<=(Fixed<IntType, IntBits> const& a, uint64_t b)
2098 {
2099  return a <= Fixed<IntType, IntBits>(b);
2100 }
2101 
2102 template<typename IntType, uint32_t IntBits>
2103 inline bool operator<=(Fixed<IntType, IntBits> const& a, int64_t b)
2104 {
2105  return a <= Fixed<IntType, IntBits>(b);
2106 }
2107 
2108 template<typename IntType, uint32_t IntBits>
2109 inline bool operator<=(Fixed<IntType, IntBits> const& a, unsigned b)
2110 {
2111  return a <= Fixed<IntType, IntBits>(b);
2112 }
2113 
2114 template<typename IntType, uint32_t IntBits>
2115 inline bool operator<=(Fixed<IntType, IntBits> const& a, int b)
2116 {
2117  return a <= Fixed<IntType, IntBits>(b);
2118 }
2119 
2120 template<typename IntType, uint32_t IntBits>
2121 inline bool operator<=(Fixed<IntType, IntBits> const& a, unsigned short b)
2122 {
2123  return a <= Fixed<IntType, IntBits>(b);
2124 }
2125 
2126 template<typename IntType, uint32_t IntBits>
2127 inline bool operator<=(Fixed<IntType, IntBits> const& a, short b)
2128 {
2129  return a <= Fixed<IntType, IntBits>(b);
2130 }
2131 
2132 template<typename IntType, uint32_t IntBits>
2133 inline bool operator<=(Fixed<IntType, IntBits> const& a,unsigned char b)
2134 {
2135  return a <= Fixed<IntType, IntBits>(b);
2136 }
2137 
2138 template<typename IntType, uint32_t IntBits>
2139 inline bool operator<=(Fixed<IntType, IntBits> const& a,char b)
2140 {
2141  return a <= Fixed<IntType, IntBits>(b);
2142 }
2143 
2144 template<typename IntType, uint32_t IntBits>
2145 inline bool operator>=(double a, Fixed<IntType, IntBits> const& b)
2146 {
2147  return Fixed<IntType, IntBits>(a) >= b;
2148 }
2149 
2150 template<typename IntType, uint32_t IntBits>
2151 inline bool operator>=(float a, Fixed<IntType, IntBits> const& b)
2152 {
2153  return Fixed<IntType, IntBits>(a) >= b;
2154 }
2155 
2156 template<typename IntType, uint32_t IntBits>
2158 {
2159  return Fixed<IntType, IntBits>(a) >= b;
2160 }
2161 
2162 template<typename IntType, uint32_t IntBits>
2164 {
2165  return Fixed<IntType, IntBits>(a) >= b;
2166 }
2167 
2168 template<typename IntType, uint32_t IntBits>
2169 inline bool operator>=(unsigned a, Fixed<IntType, IntBits> const& b)
2170 {
2171  return Fixed<IntType, IntBits>(a) >= b;
2172 }
2173 
2174 template<typename IntType, uint32_t IntBits>
2175 inline bool operator>=(int a, Fixed<IntType, IntBits> const& b)
2176 {
2177  return Fixed<IntType, IntBits>(a) >= b;
2178 }
2179 
2180 template<typename IntType, uint32_t IntBits>
2181 inline bool operator>=(unsigned short a, Fixed<IntType, IntBits> const& b)
2182 {
2183  return Fixed<IntType, IntBits>(a) >= b;
2184 }
2185 
2186 template<typename IntType, uint32_t IntBits>
2187 inline bool operator>=(short a, Fixed<IntType, IntBits> const& b)
2188 {
2189  return Fixed<IntType, IntBits>(a)>=b;
2190 }
2191 
2192 template<typename IntType, uint32_t IntBits>
2193 inline bool operator>=(unsigned char a, Fixed<IntType, IntBits> const& b)
2194 {
2195  return Fixed<IntType, IntBits>(a) >= b;
2196 }
2197 
2198 template<typename IntType, uint32_t IntBits>
2199 inline bool operator>=(char a, Fixed<IntType, IntBits> const& b)
2200 {
2201  return Fixed<IntType, IntBits>(a) >= b;
2202 }
2203 
2204 template<typename IntType, uint32_t IntBits>
2205 inline bool operator>=(Fixed<IntType, IntBits> const& a, double b)
2206 {
2207  return a >= Fixed<IntType, IntBits>(b);
2208 }
2209 
2210 template<typename IntType, uint32_t IntBits>
2211 inline bool operator>=(Fixed<IntType, IntBits> const& a,float b)
2212 {
2213  return a >= Fixed<IntType, IntBits>(b);
2214 }
2215 
2216 template<typename IntType, uint32_t IntBits>
2218 {
2219  return a >= Fixed<IntType, IntBits>(b);
2220 }
2221 
2222 template<typename IntType, uint32_t IntBits>
2224 {
2225  return a >= Fixed<IntType, IntBits>(b);
2226 }
2227 
2228 template<typename IntType, uint32_t IntBits>
2229 inline bool operator>=(Fixed<IntType, IntBits> const& a, unsigned b)
2230 {
2231  return a >= Fixed<IntType, IntBits>(b);
2232 }
2233 
2234 template<typename IntType, uint32_t IntBits>
2235 inline bool operator>=(Fixed<IntType, IntBits> const& a, int b)
2236 {
2237  return a >= Fixed<IntType, IntBits>(b);
2238 }
2239 
2240 template<typename IntType, uint32_t IntBits>
2241 inline bool operator>=(Fixed<IntType, IntBits> const& a, unsigned short b)
2242 {
2243  return a >= Fixed<IntType, IntBits>(b);
2244 }
2245 
2246 template<typename IntType, uint32_t IntBits>
2247 inline bool operator>=(Fixed<IntType, IntBits> const& a, short b)
2248 {
2249  return a >= Fixed<IntType, IntBits>(b);
2250 }
2251 
2252 template<typename IntType, uint32_t IntBits>
2253 inline bool operator>=(Fixed<IntType, IntBits> const& a, unsigned char b)
2254 {
2255  return a >= Fixed<IntType, IntBits>(b);
2256 }
2257 
2258 template<typename IntType, uint32_t IntBits>
2259 inline bool operator>=(Fixed<IntType, IntBits> const& a, char b)
2260 {
2261  return a >= Fixed<IntType, IntBits>(b);
2262 }
2263 
2264 template<typename IntType, uint32_t IntBits>
2266 {
2267  return x.sin();
2268 }
2269 
2270 template<typename IntType, uint32_t IntBits>
2272 {
2273  return x.cos();
2274 }
2275 
2276 template<typename IntType, uint32_t IntBits>
2278 {
2279  return x.tan();
2280 }
2281 
2282 template<typename IntType, uint32_t IntBits>
2284 {
2285  return x.sqrt();
2286 }
2287 
2288 template<typename IntType, uint32_t IntBits>
2290 {
2291  return x.exp();
2292 }
2293 
2294 template<typename IntType, uint32_t IntBits>
2296 {
2297  return x.log();
2298 }
2299 
2300 template<typename IntType, uint32_t IntBits>
2302 {
2303  return x.floor();
2304 }
2305 
2306 template<typename IntType, uint32_t IntBits>
2308 {
2309  return x.ceil();
2310 }
2311 
2312 template<typename IntType, uint32_t IntBits>
2314 {
2315  return x.abs();
2316 }
2317 
2318 template<typename IntType, uint32_t IntBits>
2320 {
2321  return x.modf(integral_part);
2322 }
2323 
2324 template<typename IntType, uint32_t IntBits>
2326 {
2328  return floor()+1;
2329  } else {
2330  return *this;
2331  }
2332 }
2333 
2334 template<typename IntType, uint32_t IntBits>
2336 {
2337  Fixed res(*this);
2339 
2340  if (remainder)
2341  {
2342  res.m_nVal -= remainder;
2343 
2344  if(m_nVal<0) {
2345  res-=1;
2346  }
2347  }
2348 
2349  return res;
2350 }
2351 
2352 template<typename IntType, uint32_t IntBits>
2354 {
2355  Fixed res;
2356  sin_cos(*this, &res, 0);
2357  return res;
2358 }
2359 
2360 template<typename IntType, uint32_t IntBits>
2362 {
2363  Fixed res;
2364  sin_cos(*this, 0, &res);
2365  return res;
2366 }
2367 
2368 template<typename IntType, uint32_t IntBits>
2370 {
2371  Fixed s, c;
2372  sin_cos(*this, &s, &c);
2373  return s/c;
2374 }
2375 
2376 template<typename IntType, uint32_t IntBits>
2378 {
2379  return Fixed(internal(), -m_nVal);
2380 }
2381 
2382 template<typename IntType, uint32_t IntBits>
2384 {
2386 }
2387 
2388 template<typename IntType, uint32_t IntBits>
2390 {
2392  if ((m_nVal < 0) && (fractional_part > 0)) {
2393  fractional_part -= FixedTraits<IntBits>::fixed_resolution;
2394  }
2395 
2396  integral_part->m_nVal = m_nVal - fractional_part;
2398 }
2399 
2400 template<typename IntType, uint32_t IntBits>
2401 inline Fixed<IntType, IntBits> arg(const std::complex<Fixed<IntType, IntBits> >& val)
2402 {
2403  Fixed<IntType, IntBits> r,theta;
2404  Fixed<IntType, IntBits>::to_polar(val.real(),val.imag(),&r,&theta);
2405  return theta;
2406 }
2407 
2408 template<typename IntType, uint32_t IntBits>
2409 inline std::complex<Fixed<IntType, IntBits> > polar(const Fixed<IntType, IntBits>& rho, const Fixed<IntType, IntBits>& theta)
2410 {
2412  Fixed<IntType, IntBits>::sin_cos(theta,&s,&c);
2413  return std::complex<Fixed<IntType, IntBits> >(rho * c, rho * s);
2414 }
2415 
2416 template<typename IntType, uint32_t IntBits>
2418 
2419 template<typename IntType, uint32_t IntBits>
2421 
2422 template<typename IntType, uint32_t IntBits>
2424 
2425 template<typename IntType, uint32_t IntBits>
2427 
2428 template<typename IntType, uint32_t IntBits>
2430 
2431 template<typename IntType, uint32_t IntBits>
2433 
2434 template<typename IntType, uint32_t IntBits>
2436 
2437 template<typename IntType, uint32_t IntBits>
2439 
2440 #endif /* SDRBASE_UTIL_FIXED_H_ */
Fixed & operator/=(unsigned short val)
Definition: fixed.h:344
friend bool operator<(Fixed const &lhs, Fixed const &rhs)
Definition: fixed.h:124
Fixed operator--()
Definition: fixed.h:213
static const Fixed fixed_max
Definition: fixed.h:53
Fixed & operator*=(unsigned char val)
Definition: fixed.h:292
static const Fixed fixed_half
Definition: fixed.h:56
Fixed(internal, IntType nVal)
Definition: fixed.h:69
int64_t as_int64() const
Definition: fixed.h:173
Fixed exp() const
Definition: fixed.h:532
static const Fixed fixed_two_pi
Definition: fixed.h:58
static void perform_cordic_polarization(int64_t &argx, int64_t &argy)
Definition: fixed.h:696
Fixed floor() const
Definition: fixed.h:2335
static void to_polar(Fixed const &x, Fixed const &y, Fixed *r, Fixed *theta)
Definition: fixed.h:771
Fixed operator-() const
Definition: fixed.h:2377
Fixed & operator=(Fixed const &other)
Definition: fixed.h:108
friend bool operator>(Fixed const &lhs, Fixed const &rhs)
Definition: fixed.h:129
Fixed sin() const
Definition: fixed.h:2353
Fixed & operator/=(double val)
Definition: fixed.h:298
Fixed< IntType, IntBits > operator*(double a, Fixed< IntType, IntBits > const &b)
Definition: fixed.h:1251
static void sin_cos(Fixed const &theta, Fixed *s, Fixed *c)
Definition: fixed.h:726
static const Fixed fixed_pi
Definition: fixed.h:57
uint64_t as_unsigned_long() const
Definition: fixed.h:183
Fixed(int64_t nVal)
Definition: fixed.h:72
Fixed & operator-=(Fixed const &val)
Definition: fixed.h:228
Fixed ceil() const
Definition: fixed.h:2325
Fixed & operator/=(short val)
Definition: fixed.h:320
Fixed & operator*=(char val)
Definition: fixed.h:268
Fixed(uint64_t nVal)
Definition: fixed.h:84
Fixed & operator*=(uint64_t val)
Definition: fixed.h:274
Fixed cos() const
Definition: fixed.h:2361
short as_short() const
Definition: fixed.h:197
Fixed tan() const
Definition: fixed.h:2369
__int64 int64_t
Definition: rtptypes_win.h:47
Fixed & operator*=(unsigned int val)
Definition: fixed.h:280
static const Fixed fixed_quarter_pi
Definition: fixed.h:60
Fixed()
Definition: fixed.h:65
Fixed & operator/=(unsigned char val)
Definition: fixed.h:350
unsigned short as_unsigned_short() const
Definition: fixed.h:202
Fixed & operator%=(Fixed const &other)
Definition: fixed.h:382
friend bool operator!=(Fixed const &lhs, Fixed const &rhs)
Definition: fixed.h:119
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
float as_float() const
Definition: fixed.h:159
Fixed(int nVal)
Definition: fixed.h:76
Fixed & operator*=(short val)
Definition: fixed.h:262
Fixed & operator*=(Fixed const &val)
Definition: fixed.h:389
Fixed(short nVal)
Definition: fixed.h:80
Fixed & operator/=(Fixed const &val)
Definition: fixed.h:421
Fixed & operator*=(int64_t val)
Definition: fixed.h:250
int32_t i
Definition: decimators.h:244
Fixed & operator*=(float val)
Definition: fixed.h:245
Fixed & operator=(T other)
Definition: fixed.h:102
Definition: fixed.h:42
Fixed abs() const
Definition: fixed.h:2383
unsigned int as_unsigned_int() const
Definition: fixed.h:192
friend bool operator>=(Fixed const &lhs, Fixed const &rhs)
Definition: fixed.h:139
Fixed & operator/=(unsigned int val)
Definition: fixed.h:338
Fixed & operator+=(Fixed const &val)
Definition: fixed.h:234
static int64_t scale_cordic_result(int64_t a)
Definition: fixed.h:655
static int64_t right_shift(int64_t val, int shift)
Definition: fixed.h:662
Fixed & operator*=(double val)
Definition: fixed.h:240
Fixed log() const
Definition: fixed.h:612
Fixed< IntType, IntBits > operator/(double a, Fixed< IntType, IntBits > const &b)
Definition: fixed.h:1398
IntType as_internal() const
Definition: fixed.h:154
static const Fixed fixed_half_pi
Definition: fixed.h:59
Fixed & operator/=(int64_t val)
Definition: fixed.h:308
static void perform_cordic_rotation(int64_t &px, int64_t &py, int64_t theta)
Definition: fixed.h:668
bool operator!() const
Definition: fixed.h:356
Fixed< IntType, IntBits > operator%(double a, Fixed< IntType, IntBits > const &b)
Definition: fixed.h:957
Fixed(unsigned short nVal)
Definition: fixed.h:91
IntType m_nVal
Definition: fixed.h:45
double as_double() const
Definition: fixed.h:164
Fixed & operator*=(unsigned short val)
Definition: fixed.h:286
Fixed< IntType, IntBits > operator+(double a, Fixed< IntType, IntBits > const &b)
Definition: fixed.h:1104
Fixed & operator/=(char val)
Definition: fixed.h:326
friend bool operator<=(Fixed const &lhs, Fixed const &rhs)
Definition: fixed.h:134
std::complex< Fixed< IntType, IntBits > > polar(const Fixed< IntType, IntBits > &rho, const Fixed< IntType, IntBits > &theta)
Definition: fixed.h:2409
Fixed atan() const
Definition: fixed.h:763
int as_int() const
Definition: fixed.h:178
Fixed & operator/=(int val)
Definition: fixed.h:314
static const Fixed fixed_one
Definition: fixed.h:54
friend bool operator==(Fixed const &lhs, Fixed const &rhs)
Definition: fixed.h:114
Fixed(float nVal)
Definition: fixed.h:97
Fixed operator++()
Definition: fixed.h:207
int64_t as_long() const
Definition: fixed.h:169
Fixed & operator*=(int val)
Definition: fixed.h:256
Fixed & operator/=(float val)
Definition: fixed.h:303
uint64_t as_unsigned_int64() const
Definition: fixed.h:187
Fixed & operator/=(uint64_t val)
Definition: fixed.h:332
Fixed sqrt() const
Definition: fixed.h:483
Fixed(double nVal)
Definition: fixed.h:94
T max(const T &x, const T &y)
Definition: framework.h:446
Fixed(unsigned int nVal)
Definition: fixed.h:88
Fixed modf(Fixed *integral_part) const
Definition: fixed.h:2389
static const Fixed fixed_zero
Definition: fixed.h:55
unsigned __int64 uint64_t
Definition: rtptypes_win.h:48