|
units
Use physical dimensions at compile-time or run-time.
|
Encoding of numerator and denominator into unsigned word. More...
#include <encoding.hpp>
Public Types | |
| enum | { BITS = NMR_BITS + DNM_BITS } |
| enum | { DNM_MASK = bit_range<utype>(0, DNM_BITS - 1), NMR_MASK = bit_range<utype>(DNM_BITS, BITS - 1) } |
| Mask for each of numerator and denominator. More... | |
| using | utype = typename int_types< BITS >::US |
| Unsigned type for encoding. More... | |
| using | stype = typename int_types< BITS >::SS |
| Signed type for encoding. More... | |
| using | uftype = typename int_types< BITS >::UF |
| Unsigned fast type. More... | |
| using | sftype = typename int_types< BITS >::SF |
| Signed fast type. More... | |
Public Member Functions | |
| constexpr | encoding (normalized_pair< NMR_BITS, DNM_BITS > p) |
| Initialize from normalized numerator and denominator. More... | |
| constexpr int_types< NMR_BITS >::SF | n () const |
| Normalized numerator. More... | |
| constexpr int_types< DNM_BITS >::UF | d () const |
| Normalized denominator. More... | |
Protected Member Functions | |
| constexpr | encoding (utype c) |
| Allow descendant to construct from code-word. More... | |
Protected Attributes | |
| utype | c_ |
| Unsigned word storing encoding. More... | |
Static Private Member Functions | |
| static constexpr utype | encode (normalized_pair< NMR_BITS, DNM_BITS > p) |
| Calculated encoding from normalized numerator and denominator. More... | |
Encoding of numerator and denominator into unsigned word.
| NMR_BITS | Number of bits for numerator. |
| DNM_BITS | Number of bits for denominator. |
Definition at line 19 of file encoding.hpp.
| using vnix::rat::encoding< NMR_BITS, DNM_BITS >::sftype = typename int_types<BITS>::SF |
Signed fast type.
Definition at line 25 of file encoding.hpp.
| using vnix::rat::encoding< NMR_BITS, DNM_BITS >::stype = typename int_types<BITS>::SS |
Signed type for encoding.
Definition at line 23 of file encoding.hpp.
| using vnix::rat::encoding< NMR_BITS, DNM_BITS >::uftype = typename int_types<BITS>::UF |
Unsigned fast type.
Definition at line 24 of file encoding.hpp.
| using vnix::rat::encoding< NMR_BITS, DNM_BITS >::utype = typename int_types<BITS>::US |
Unsigned type for encoding.
Definition at line 22 of file encoding.hpp.
| anonymous enum |
| anonymous enum |
Mask for each of numerator and denominator.
| Enumerator | |
|---|---|
| DNM_MASK |
Mask for denominator. |
| NMR_MASK |
Mask for numerator. |
Definition at line 28 of file encoding.hpp.
|
inlineprotected |
Allow descendant to construct from code-word.
| c | Code-word. |
Definition at line 47 of file encoding.hpp.
|
inline |
Initialize from normalized numerator and denominator.
| p | Normalized numerator and denominator. |
Definition at line 52 of file encoding.hpp.
|
inline |
Normalized denominator.
Definition at line 68 of file encoding.hpp.
|
inlinestaticprivate |
Calculated encoding from normalized numerator and denominator.
| p | Normalized numerator and denominator. |
Definition at line 36 of file encoding.hpp.
|
inline |
Normalized numerator.
Definition at line 55 of file encoding.hpp.
|
protected |
Unsigned word storing encoding.
Definition at line 43 of file encoding.hpp.
1.8.11