llvm-mos-sdk
fixed_point.h
Go to the documentation of this file.
1 // Copyright 2024 LLVM-MOS Project
2 // Licensed under the Apache License, Version 2.0 with LLVM Exceptions.
3 // See https://github.com/llvm-mos/llvm-mos-sdk/blob/main/LICENSE for license
4 // information.
5 
6 #ifndef _FIXED_POINT_H
7 #define _FIXED_POINT_H
8 
9 #include <cstdint>
10 #include <limits.h>
11 #include <stdio.h>
12 #include <type_traits>
13 
14 #if __cplusplus >= 202002L
15 #define __fp_consteval consteval
16 #else
17 #define __fp_consteval constexpr
18 #endif
19 
47 template <intmax_t IntSize, intmax_t FracSize, bool Signed = true>
48 class FixedPoint;
49 
50 template <intmax_t IntSize, intmax_t FracSize, bool Signed> class FixedPoint {
51  static __fp_consteval auto bytesForBits(intmax_t v) { return ((v + 7) / 8); }
52  static constexpr auto storage_size = bytesForBits(IntSize + FracSize) * 8;
53 
54  // The result type for binary operations, similar to the C integer rules. The
55  // larger of the integer and fractional sizes are used. If the integer sizes
56  // differ, has the signedness of the larger. Otherwise, signed iff both
57  // are signed.
58  template <intmax_t OI, intmax_t OF, bool S>
59  using BinaryResultT =
60  FixedPoint<(OI > IntSize ? OI : IntSize), (OF > FracSize ? OF : FracSize),
61  (OI > IntSize ? S
62  : OI < IntSize ? Signed
63  : S && Signed)>;
64 
65 public:
66  using IntType =
67  std::conditional_t<Signed, _BitInt(IntSize), unsigned _BitInt(IntSize)>;
68  using FracType = unsigned _BitInt(FracSize);
69  using StorageType = std::conditional_t<Signed, _BitInt(storage_size),
70  unsigned _BitInt(storage_size)>;
71 
72 private:
73  // Underlying storage for the type
74  union {
76  struct {
77  FracType f : FracSize;
78  IntType i : IntSize;
79  };
80  };
81 
82 public:
83  // Constructors
84  template <typename T, std::enable_if_t<std::is_integral_v<T>, bool> = true>
85  [[clang::always_inline]] constexpr FixedPoint(T i)
86  : val((StorageType)i << FracSize) {}
87 
89  [[clang::always_inline]] constexpr FixedPoint(IntType i, FracType f)
90  : val((StorageType)i << FracSize | f) {}
91 
92  // The implicitly defined constructors work for this class, so using the
93  // default constructors allow us to use this class in contexts that
94  // require trivial types.
95  constexpr FixedPoint() = default;
96 
101  template <typename T,
102  std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
103  [[clang::always_inline]] __fp_consteval explicit FixedPoint(T f) {
104  set(f * ((StorageType)1 << FracSize));
105  }
106 
107  // Implicit conversion. Like C/C++ integers, silently truncate on conversion
108  // to a smaller type.
109  template <intmax_t OI, intmax_t OF, bool S>
110  [[clang::always_inline]] constexpr FixedPoint(FixedPoint<OI, OF, S> o) {
111  if constexpr (FracSize > OF)
112  *this = FixedPoint(o.as_i(), (FracType)o.as_f() << (FracSize - OF));
113  else
114  *this = FixedPoint(o.as_i(), o.as_f() >> (OF - FracSize));
115  }
116 
117  // Direct value accessor and setter methods
118 
120  [[clang::always_inline]] constexpr IntType as_i() const { return i; }
122  [[clang::always_inline]] constexpr FracType as_f() const { return f; }
124  [[clang::always_inline]] constexpr StorageType get() const { return val; }
126  [[clang::always_inline]] constexpr void set_i(IntType value) { i = value; }
128  [[clang::always_inline]] constexpr void set_f(FracType value) { f = value; }
130  [[clang::always_inline]] constexpr void set(StorageType value) {
131  val = value;
132  }
133 
137  template <intmax_t OI, intmax_t OF, bool S = true>
138  [[clang::always_inline]] constexpr FixedPoint<OI, OF, S> as() {
139  return FixedPoint<OI, OF, S>(*this);
140  }
141 
142  [[clang::always_inline]] constexpr bool is_signed() const { return Signed; }
143  [[clang::always_inline]] constexpr intmax_t bitcount() const {
144  return IntSize + FracSize;
145  }
146  [[clang::always_inline]] constexpr intmax_t int_bitcount() const {
147  return IntSize;
148  }
149  [[clang::always_inline]] constexpr intmax_t frac_bitcount() const {
150  return FracSize;
151  }
152 
153  // Operator overloads
154 
155  // Unary operators
156  [[clang::always_inline]] constexpr FixedPoint operator-() const {
157  FixedPoint n = *this;
158  n.set(-n.get());
159  return n;
160  }
161  [[clang::always_inline]] constexpr FixedPoint operator~() const {
162  FixedPoint n = *this;
163  n.set(~n.get());
164  return n;
165  }
166 
167  // Bitwise operators
168  [[clang::always_inline]] constexpr FixedPoint &operator%=(FixedPoint o) {
169  val %= o.val;
170  return *this;
171  }
172  [[clang::always_inline]] constexpr FixedPoint operator%(FixedPoint o) const {
173  FixedPoint n = *this;
174  n %= o;
175  return n;
176  }
177  [[clang::always_inline]] constexpr FixedPoint &operator&=(FixedPoint o) {
178  val &= o.val;
179  return *this;
180  }
181  [[clang::always_inline]] constexpr FixedPoint operator&(FixedPoint o) const {
182  FixedPoint n = *this;
183  n &= o;
184  return n;
185  }
186  [[clang::always_inline]] constexpr FixedPoint &operator|=(FixedPoint o) {
187  val |= o.val;
188  return *this;
189  }
190  [[clang::always_inline]] constexpr FixedPoint operator|(FixedPoint o) const {
191  FixedPoint n = *this;
192  n |= o;
193  return n;
194  }
195  [[clang::always_inline]] constexpr FixedPoint &operator^=(FixedPoint o) {
196  val ^= o.val;
197  return *this;
198  }
199  [[clang::always_inline]] constexpr FixedPoint operator^(FixedPoint o) const {
200  FixedPoint n = *this;
201  n ^= o;
202  return n;
203  }
204 
205  // Arithimetic operators for same sized types
206  [[clang::always_inline]] constexpr FixedPoint &operator+=(FixedPoint o) {
207  val += o.val;
208  return *this;
209  }
210  [[clang::always_inline]] constexpr FixedPoint operator+(FixedPoint o) const {
211  FixedPoint n = *this;
212  n += o;
213  return n;
214  }
215 
216  [[clang::always_inline]] constexpr FixedPoint &operator-=(FixedPoint o) {
217  val -= o.val;
218  return *this;
219  }
220  [[clang::always_inline]] constexpr FixedPoint operator-(FixedPoint o) const {
221  FixedPoint n = *this;
222  n -= o;
223  return n;
224  }
225 
226  [[clang::always_inline]] constexpr FixedPoint &operator/=(FixedPoint o) {
227  // Fixed point division is (n << FracSize) / m to maintain the scale.
228  // Widen the numerator before shifting to avoid overflow.
230  val = (temp.get() << FracSize) / o.get();
231  return *this;
232  }
233  [[clang::always_inline]] constexpr FixedPoint operator/(FixedPoint o) const {
234  FixedPoint n = *this;
235  n /= o;
236  return n;
237  }
238 
239  [[clang::always_inline]] constexpr FixedPoint &operator*=(FixedPoint o) {
240  // Fixed point mult is (n * m / FracSize)
241  // Expand the immediate value before multiplying
244  // Truncate the final result to fit inside our value
245  val = (temp.get() * other.get()) >> FracSize;
246  return *this;
247  }
248  [[clang::always_inline]] constexpr FixedPoint operator*(FixedPoint o) const {
249  FixedPoint n = *this;
250  n *= o;
251  return n;
252  }
253 
254  [[clang::always_inline]] constexpr FixedPoint &operator>>=(StorageType v) {
255  val >>= v;
256  return *this;
257  }
258  [[clang::always_inline]] constexpr FixedPoint
260  FixedPoint n = *this;
261  n >>= v;
262  return n;
263  }
264 
265  [[clang::always_inline]] constexpr FixedPoint &operator<<=(StorageType v) {
266  val <<= v;
267  return *this;
268  }
269  [[clang::always_inline]] constexpr FixedPoint
270  operator<<(StorageType v) const {
271  FixedPoint n = *this;
272  n <<= v;
273  return n;
274  }
275 
276  [[clang::always_inline]] FixedPoint &operator++() {
277  i += 1;
278  return *this;
279  }
280  [[clang::always_inline]] FixedPoint operator++(int) {
281  FixedPoint old = *this;
282  ++*this;
283  return old;
284  }
285 
286  template <intmax_t OI, intmax_t OF, bool S>
287  [[clang::always_inline]] constexpr auto
289  BinaryResultT<OI, OF, S> l = *this;
291  l += r;
292  return l;
293  }
294  template <intmax_t OI, intmax_t OF, bool S>
295  [[clang::always_inline]] constexpr FixedPoint &
297  *this = *this + o;
298  return *this;
299  }
300 
301  template <intmax_t OI, intmax_t OF, bool S>
302  [[clang::always_inline]] constexpr auto
304  BinaryResultT<OI, OF, S> l = *this;
306  l -= r;
307  return l;
308  }
309  template <intmax_t OI, intmax_t OF, bool S>
310  [[clang::always_inline]] constexpr FixedPoint &
312  *this = *this - o;
313  return *this;
314  }
315  template <intmax_t OI, intmax_t OF, bool S>
316  [[clang::always_inline]] constexpr auto
318  BinaryResultT<OI, OF, S> l = *this;
320  l %= r;
321  return l;
322  }
323  template <intmax_t OI, intmax_t OF, bool S>
324  [[clang::always_inline]] constexpr FixedPoint &
326  *this = *this % o;
327  return *this;
328  }
329  template <intmax_t OI, intmax_t OF, bool S>
330  [[clang::always_inline]] constexpr auto
332  BinaryResultT<OI, OF, S> l = *this;
334  l ^= r;
335  return l;
336  }
337  template <intmax_t OI, intmax_t OF, bool S>
338  [[clang::always_inline]] constexpr FixedPoint &
340  *this = *this ^ o;
341  return *this;
342  }
343  template <intmax_t OI, intmax_t OF, bool S>
344  [[clang::always_inline]] constexpr auto
346  BinaryResultT<OI, OF, S> l = *this;
348  l &= r;
349  return l;
350  }
351  template <intmax_t OI, intmax_t OF, bool S>
352  [[clang::always_inline]] constexpr FixedPoint &
354  *this = *this & o;
355  return *this;
356  }
357  template <intmax_t OI, intmax_t OF, bool S>
358  [[clang::always_inline]] constexpr auto
360  BinaryResultT<OI, OF, S> l = *this;
362  l |= r;
363  return l;
364  }
365  template <intmax_t OI, intmax_t OF, bool S>
366  [[clang::always_inline]] constexpr FixedPoint &
368  *this = *this | o;
369  return *this;
370  }
371 
372  template <intmax_t OI, intmax_t OF, bool S>
373  [[clang::always_inline]] constexpr auto
375  BinaryResultT<OI, OF, S> l = *this;
377  return l * r;
378  }
379  template <intmax_t OI, intmax_t OF, bool S>
380  [[clang::always_inline]] constexpr FixedPoint &
382  *this = *this * o;
383  return *this;
384  }
385 
386  // Comparison overloads
387  [[clang::always_inline]] constexpr bool
388  operator==(const FixedPoint &o) const noexcept {
389  return val == o.val;
390  }
391  [[clang::always_inline]] constexpr bool
392  operator<(const FixedPoint &o) const noexcept {
393  return val < o.val;
394  }
395  [[clang::always_inline]] constexpr bool
396  operator!=(const FixedPoint &o) const noexcept {
397  return val != o.val;
398  }
399  [[clang::always_inline]] constexpr bool
400  operator>(const FixedPoint &o) const noexcept {
401  return val > o.val;
402  }
403  [[clang::always_inline]] constexpr bool
404  operator>=(const FixedPoint &o) const noexcept {
405  return val >= o.val;
406  }
407  [[clang::always_inline]] constexpr bool
408  operator<=(const FixedPoint &o) const noexcept {
409  return val <= o.val;
410  }
411  template <intmax_t OI, intmax_t OF, bool S>
412  [[clang::always_inline]] constexpr auto
413  operator==(FixedPoint<OI, OF, S> o) const noexcept {
414  BinaryResultT<OI, OF, S> l = *this;
416  return l == r;
417  }
418  template <intmax_t OI, intmax_t OF, bool S>
419  [[clang::always_inline]] constexpr auto
420  operator<(FixedPoint<OI, OF, S> o) const noexcept {
421  BinaryResultT<OI, OF, S> l = *this;
423  return l < r;
424  }
425  template <intmax_t OI, intmax_t OF, bool S>
426  [[clang::always_inline]] constexpr auto
427  operator!=(FixedPoint<OI, OF, S> o) const noexcept {
428  BinaryResultT<OI, OF, S> l = *this;
430  return l != r;
431  }
432  template <intmax_t OI, intmax_t OF, bool S>
433  [[clang::always_inline]] constexpr auto
434  operator>(FixedPoint<OI, OF, S> o) const noexcept {
435  BinaryResultT<OI, OF, S> l = *this;
437  return l > r;
438  }
439  template <intmax_t OI, intmax_t OF, bool S>
440  [[clang::always_inline]] constexpr auto
441  operator>=(FixedPoint<OI, OF, S> o) const noexcept {
442  BinaryResultT<OI, OF, S> l = *this;
444  return l >= r;
445  }
446  template <intmax_t OI, intmax_t OF, bool S>
447  [[clang::always_inline]] constexpr auto
448  operator<=(FixedPoint<OI, OF, S> o) const noexcept {
449  BinaryResultT<OI, OF, S> l = *this;
451  return l <= r;
452  }
453 };
454 
464 
472 
480 
481 using f8_8 = fs8_8;
482 using f12_4 = fs12_4;
483 using f16_8 = fs16_8;
484 using f8_16 = fs8_16;
485 using f12_12 = fs12_12;
486 using f16_16 = fs16_16;
487 using f24_8 = fs24_8;
488 
489 [[clang::always_inline]] __fp_consteval fs8_8
490 operator""_s8_8(long double fixed) {
491  return FixedPoint<8, 8, true>{fixed};
492 }
493 [[clang::always_inline]] __fp_consteval fs12_4
494 operator""_s12_4(long double fixed) {
495  return FixedPoint<12, 4, true>{fixed};
496 }
497 [[clang::always_inline]] __fp_consteval fs16_8
498 operator""_s16_8(long double fixed) {
499  return FixedPoint<16, 8, true>{fixed};
500 }
501 [[clang::always_inline]] __fp_consteval fs8_16
502 operator""_s8_16(long double fixed) {
503  return FixedPoint<8, 16, true>{fixed};
504 }
505 [[clang::always_inline]] __fp_consteval fs12_12
506 operator""_s12_12(long double fixed) {
507  return FixedPoint<12, 12, true>{fixed};
508 }
509 [[clang::always_inline]] __fp_consteval fs16_16
510 operator""_s16_16(long double fixed) {
511  return FixedPoint<16, 16, true>{fixed};
512 }
513 [[clang::always_inline]] __fp_consteval fs24_8
514 operator""_s24_8(long double fixed) {
515  return FixedPoint<24, 8, true>{fixed};
516 }
517 
518 [[clang::always_inline]] __fp_consteval fu8_8
519 operator""_u8_8(long double fixed) {
520  return FixedPoint<8, 8, false>{fixed};
521 }
522 [[clang::always_inline]] __fp_consteval fu12_4
523 operator""_u12_4(long double fixed) {
524  return FixedPoint<12, 4, false>{fixed};
525 }
526 [[clang::always_inline]] __fp_consteval fu16_8
527 operator""_u16_8(long double fixed) {
528  return FixedPoint<16, 8, false>{fixed};
529 }
530 [[clang::always_inline]] __fp_consteval fu8_16
531 operator""_u8_16(long double fixed) {
532  return FixedPoint<8, 16, false>{fixed};
533 }
534 [[clang::always_inline]] __fp_consteval fu12_12
535 operator""_u12_12(long double fixed) {
536  return FixedPoint<12, 12, false>{fixed};
537 }
538 [[clang::always_inline]] __fp_consteval fu16_16
539 operator""_u16_16(long double fixed) {
540  return FixedPoint<16, 16, false>{fixed};
541 }
542 [[clang::always_inline]] __fp_consteval fu24_8
543 operator""_u24_8(long double fixed) {
544  return FixedPoint<24, 8, false>{fixed};
545 }
546 
547 [[clang::always_inline]] __fp_consteval fs8_8
548 operator""_8_8(long double fixed) {
549  return FixedPoint<8, 8, true>{fixed};
550 }
551 [[clang::always_inline]] __fp_consteval fs12_4
552 operator""_12_4(long double fixed) {
553  return FixedPoint<12, 4, true>{fixed};
554 }
555 [[clang::always_inline]] __fp_consteval fs16_8
556 operator""_16_8(long double fixed) {
557  return FixedPoint<16, 8, true>{fixed};
558 }
559 [[clang::always_inline]] __fp_consteval fs8_16
560 operator""_8_16(long double fixed) {
561  return FixedPoint<8, 16, true>{fixed};
562 }
563 [[clang::always_inline]] __fp_consteval fs12_12
564 operator""_12_12(long double fixed) {
565  return FixedPoint<12, 12, true>{fixed};
566 }
567 [[clang::always_inline]] __fp_consteval fs16_16
568 operator""_16_16(long double fixed) {
569  return FixedPoint<16, 16, true>{fixed};
570 }
571 [[clang::always_inline]] __fp_consteval fs24_8
572 operator""_24_8(long double fixed) {
573  return FixedPoint<24, 8, true>{fixed};
574 }
575 } // namespace fixedpoint_literals
576 
577 #endif // _FIXED_POINT_H
Definition: fixed_point.h:50
constexpr auto operator+(FixedPoint< OI, OF, S > o) const
Definition: fixed_point.h:288
constexpr FixedPoint & operator|=(FixedPoint< OI, OF, S > o)
Definition: fixed_point.h:367
constexpr FixedPoint operator~() const
Definition: fixed_point.h:161
constexpr FixedPoint & operator&=(FixedPoint o)
Definition: fixed_point.h:177
FixedPoint operator++(int)
Definition: fixed_point.h:280
StorageType val
Definition: fixed_point.h:75
constexpr void set_f(FracType value)
Update just the fractional portion.
Definition: fixed_point.h:128
constexpr FixedPoint & operator%=(FixedPoint o)
Definition: fixed_point.h:168
constexpr FixedPoint & operator+=(FixedPoint< OI, OF, S > o)
Definition: fixed_point.h:296
FracType f
Definition: fixed_point.h:77
constexpr IntType as_i() const
Returns just the integral portion.
Definition: fixed_point.h:120
constexpr FixedPoint operator-(FixedPoint o) const
Definition: fixed_point.h:220
constexpr FixedPoint & operator+=(FixedPoint o)
Definition: fixed_point.h:206
constexpr void set(StorageType value)
Update the entire value.
Definition: fixed_point.h:130
constexpr FixedPoint operator|(FixedPoint o) const
Definition: fixed_point.h:190
unsigned _BitInt(FracSize) FracType
Definition: fixed_point.h:68
constexpr FixedPoint operator*(FixedPoint o) const
Definition: fixed_point.h:248
constexpr auto operator==(FixedPoint< OI, OF, S > o) const noexcept
Definition: fixed_point.h:413
constexpr FixedPoint & operator|=(FixedPoint o)
Definition: fixed_point.h:186
constexpr FixedPoint operator<<(StorageType v) const
Definition: fixed_point.h:270
constexpr bool operator!=(const FixedPoint &o) const noexcept
Definition: fixed_point.h:396
constexpr auto operator!=(FixedPoint< OI, OF, S > o) const noexcept
Definition: fixed_point.h:427
constexpr FixedPoint()=default
constexpr FixedPoint & operator*=(FixedPoint o)
Definition: fixed_point.h:239
constexpr FixedPoint operator%(FixedPoint o) const
Definition: fixed_point.h:172
constexpr FixedPoint & operator&=(FixedPoint< OI, OF, S > o)
Definition: fixed_point.h:353
IntType i
Definition: fixed_point.h:78
std::conditional_t< Signed, _BitInt(storage_size), unsigned _BitInt(storage_size)> StorageType
Definition: fixed_point.h:70
constexpr auto operator*(FixedPoint< OI, OF, S > o) const
Definition: fixed_point.h:374
constexpr bool operator>(const FixedPoint &o) const noexcept
Definition: fixed_point.h:400
constexpr auto operator%(FixedPoint< OI, OF, S > o) const
Definition: fixed_point.h:317
constexpr FixedPoint & operator%=(FixedPoint< OI, OF, S > o)
Definition: fixed_point.h:325
constexpr FixedPoint(IntType i, FracType f)
Constructor for setting both the integral and fractional part.
Definition: fixed_point.h:89
constexpr FixedPoint operator+(FixedPoint o) const
Definition: fixed_point.h:210
constexpr bool operator<(const FixedPoint &o) const noexcept
Definition: fixed_point.h:392
constexpr FixedPoint & operator>>=(StorageType v)
Definition: fixed_point.h:254
constexpr FixedPoint operator>>(StorageType v) const
Definition: fixed_point.h:259
constexpr void set_i(IntType value)
Update just the integral portion.
Definition: fixed_point.h:126
constexpr auto operator-(FixedPoint< OI, OF, S > o) const
Definition: fixed_point.h:303
constexpr FixedPoint & operator^=(FixedPoint o)
Definition: fixed_point.h:195
constexpr FixedPoint & operator*=(FixedPoint< OI, OF, S > o)
Definition: fixed_point.h:381
constexpr bool operator<=(const FixedPoint &o) const noexcept
Definition: fixed_point.h:408
constexpr intmax_t frac_bitcount() const
Definition: fixed_point.h:149
constexpr FracType as_f() const
Returns just the fractional portion.
Definition: fixed_point.h:122
constexpr auto operator>=(FixedPoint< OI, OF, S > o) const noexcept
Definition: fixed_point.h:441
constexpr FixedPoint(T i)
Definition: fixed_point.h:85
constexpr FixedPoint operator/(FixedPoint o) const
Definition: fixed_point.h:233
constexpr intmax_t bitcount() const
Definition: fixed_point.h:143
constexpr bool operator>=(const FixedPoint &o) const noexcept
Definition: fixed_point.h:404
constexpr auto operator&(FixedPoint< OI, OF, S > o) const
Definition: fixed_point.h:345
constexpr auto operator|(FixedPoint< OI, OF, S > o) const
Definition: fixed_point.h:359
constexpr auto operator^(FixedPoint< OI, OF, S > o) const
Definition: fixed_point.h:331
FixedPoint & operator++()
Definition: fixed_point.h:276
constexpr bool is_signed() const
Definition: fixed_point.h:142
constexpr bool operator==(const FixedPoint &o) const noexcept
Definition: fixed_point.h:388
constexpr auto operator>(FixedPoint< OI, OF, S > o) const noexcept
Definition: fixed_point.h:434
constexpr FixedPoint operator&(FixedPoint o) const
Definition: fixed_point.h:181
constexpr StorageType get() const
Returns the entire value.
Definition: fixed_point.h:124
constexpr FixedPoint & operator<<=(StorageType v)
Definition: fixed_point.h:265
constexpr FixedPoint & operator/=(FixedPoint o)
Definition: fixed_point.h:226
constexpr FixedPoint & operator-=(FixedPoint< OI, OF, S > o)
Definition: fixed_point.h:311
constexpr FixedPoint operator-() const
Definition: fixed_point.h:156
constexpr FixedPoint< OI, OF, S > as()
Definition: fixed_point.h:138
constexpr FixedPoint operator^(FixedPoint o) const
Definition: fixed_point.h:199
constexpr intmax_t int_bitcount() const
Definition: fixed_point.h:146
constexpr FixedPoint & operator-=(FixedPoint o)
Definition: fixed_point.h:216
constexpr FixedPoint(FixedPoint< OI, OF, S > o)
Definition: fixed_point.h:110
constexpr FixedPoint & operator^=(FixedPoint< OI, OF, S > o)
Definition: fixed_point.h:339
std::conditional_t< Signed, _BitInt(IntSize), unsigned _BitInt(IntSize)> IntType
Definition: fixed_point.h:67
char value
Definition: bios.h:265
Definition: fixed_point.h:463
FixedPoint< 24, 8, true > fs24_8
Definition: fixed_point.h:471
FixedPoint< 16, 8, true > fs16_8
Definition: fixed_point.h:467
FixedPoint< 16, 16, false > fu16_16
Definition: fixed_point.h:478
FixedPoint< 16, 16, true > fs16_16
Definition: fixed_point.h:470
FixedPoint< 16, 8, false > fu16_8
Definition: fixed_point.h:475
FixedPoint< 8, 8, true > fs8_8
Definition: fixed_point.h:465
FixedPoint< 8, 8, false > fu8_8
Definition: fixed_point.h:473
FixedPoint< 8, 16, true > fs8_16
Definition: fixed_point.h:468
FixedPoint< 12, 4, false > fu12_4
Definition: fixed_point.h:474
FixedPoint< 12, 4, true > fs12_4
Definition: fixed_point.h:466
FixedPoint< 8, 16, false > fu8_16
Definition: fixed_point.h:476
FixedPoint< 12, 12, false > fu12_12
Definition: fixed_point.h:477
FixedPoint< 24, 8, false > fu24_8
Definition: fixed_point.h:479
FixedPoint< 12, 12, true > fs12_12
Definition: fixed_point.h:469
::intmax_t intmax_t
Definition: cstdint:19
typename conditional< B, T, F >::type conditional_t
Definition: type_traits:26