units
Use physical dimensions at compile-time or run-time.
|
Thomas E. Vaughan's public software. More...
Namespaces | |
impl | |
mv | |
rat | |
Classes and functions supporting a model of a fixed-precision rational number. | |
units | |
Classes and functions supporting a model of physically dimensioned quantities. | |
Classes | |
struct | int_types |
Smallest integer types for holding certain number of bits. More... | |
struct | int_types< 16 > |
Terminal specialization of int_types for 16-bit integer. More... | |
struct | int_types< 32 > |
Terminal specialization of int_types for 32-bit integer. More... | |
struct | int_types< 64 > |
Terminal specialization of int_types for 64-bit integer. More... | |
struct | int_types< 8 > |
Terminal specialization of int_types for eight-bit integer. More... | |
Typedefs | |
template<typename U , typename V > | |
using | gcd_promoted = decltype(U()%V()) |
Output-type resulting from modular division of input-types. More... | |
template<unsigned NB, unsigned DB> | |
using | rational = rat::rational< NB, DB > |
Bring class rational into vnix namespace. More... | |
using | rat8_t = rational< 5, 3 > |
Rational with five bits for numerator and three for denominator. More... | |
using | rat16_t = rational< 9, 7 > |
Rational with nine bits for numerator and seven for denominator. More... | |
using | rat32_t = rational< 17, 15 > |
Rational with 17 bits for numerator and 15 for denominator. More... | |
using | rat64_t = rational< 33, 31 > |
Rational with 33 bits for numerator and 31 for denominator. More... | |
Functions | |
template<typename A , typename B > | |
constexpr gcd_promoted< A, B > | gcd (A a, B b) |
Greatest common divisor of two numbers; only absolute values are used. More... | |
template<typename I > | |
constexpr I | bit (unsigned n) |
Word with specified bit set. More... | |
template<typename I > | |
constexpr I | bit_range (unsigned n1, unsigned n2) |
Word with specified range of bits set. More... | |
Thomas E. Vaughan's public software.
using vnix::gcd_promoted = typedef decltype(U() % V()) |
using vnix::rat16_t = typedef rational<9, 7> |
using vnix::rat32_t = typedef rational<17, 15> |
using vnix::rat64_t = typedef rational<33, 31> |
using vnix::rat8_t = typedef rational<5, 3> |
using vnix::rational = typedef rat::rational<NB, DB> |
constexpr I vnix::bit | ( | unsigned | n | ) |
Word with specified bit set.
I | Type of integer word. |
n | Offset of bit in word. |
Definition at line 15 of file bit-range.hpp.
constexpr I vnix::bit_range | ( | unsigned | n1, |
unsigned | n2 | ||
) |
Word with specified range of bits set.
I | Type of integer word. |
n1 | Offset of bit at one end of range. |
n2 | Offset of bit at other end of range. |
Definition at line 22 of file bit-range.hpp.
constexpr gcd_promoted<A, B> vnix::gcd | ( | A | a, |
B | b | ||
) |
Greatest common divisor of two numbers; only absolute values are used.
a | First number. |
b | Second number. |
Definition at line 40 of file gcd.hpp.