util.hpp File Reference
Detailed Description
Auxiliary constants and functions.
This header file contains declaration of the some useful constants and auxiliary functions.
- Author:
- Sergey Polichnoy
Go to the source code of this file.
Namespaces
Constants
- const double SQRT2
- Square root of 2.
- const double SQRT3
- Square root of 3.
- const double LG2
- Decimal logarithm of 2.
- const double LN2
- Natural logarithm of 2.
- const double PI
- The Pi value.
Conversions
- double deg2rad (double deg)
- Convert degrees to the radians.
- double rad2deg (double rad)
- Convert radians to the degrees.
- double dB2line (double dB)
- Convert dB to the value in linear scale.
- double line2dB (double L)
- Convert value in linear scale to the dB.
- double dBm2watt (double dBm)
- Convert dBm to the watts.
- double watt2dBm (double W)
- Convert watts to the dBm.
- double kph2mps (double kph)
- Convert kph to the mps.
- double mps2kph (double mps)
- Convert mps to the kph.
Power of two and parity
- template<typename T> bool is_ipow2 (T x)
- Is integer power of two?
- template<typename T> T log2 (T x)
- Binary integer logarithm.
- template<typename T> T flp2 (T x)
- Nearest (floor) integer power of two.
- template<typename T> T clp2 (T x)
- Nearest (ceil) integer power of two.
- template<typename T> T parity (T x)
- Parity bit.
Bits packing/unpacking and flip
- template<typename T, typename In> T bi2de_msb (In first, size_t Nbits, T x=T())
- Binary to decimal (MSB first).
- template<typename T, typename Out> Out de2bi_msb (T x, size_t Nbits, Out first)
- Decimal to binary (MSB first).
- template<typename T, typename In> T bi2de_lsb (In first, size_t Nbits, T x=T())
- Binary to decimal (LSB first).
- template<typename T, typename Out> Out de2bi_lsb (T x, size_t Nbits, Out first)
- Decimal to binary (LSB first).
- template<typename T> T bits_flip (T x, size_t Nbits)
- Reverse the bit order.
Polynomials
- template<typename TY, typename TX, typename Bi> TY poly (const TX &x, Bi first, Bi last, const TY &)
- Calculate the polynomial's function.
- template<typename T, typename Bi> T poly (const T &x, Bi first, Bi last)
- Calculate the polynomial's function.
Generated on Wed Jun 6 17:27:47 2007 for OMNI by
1.5.2