Skip to content

These module docs are in beta and may be incomplete.

modm:math:utils: Utilities


// Struct
struct modm::ArithmeticTraits< typename T  >;

// Function
bool modm::isPositive(const float &a);
const T& modm::max(const T &a, const T &b);
const T& modm::max(const T &a, const T &b, Compare compare);
const T& modm::min(const T &a, const T &b);
const T& modm::min(const T &a, const T &b, Compare compare);
constexpr T modm::max(const T a, const T b, const T c);
constexpr bool modm::isBigEndian();
constexpr bool modm::isLittleEndian();
constexpr int8_t modm::leftmostBit(uint32_t value);
constexpr uint32_t modm::pow(uint32_t base, uint8_t exponent);
int16_t modm::fromBigEndian(int16_t value);
int16_t modm::fromLittleEndian(int16_t value);
int16_t modm::toBigEndian(int16_t value);
int16_t modm::toLittleEndian(int16_t value);
int32_t modm::fromBigEndian(int32_t value);
int32_t modm::fromLittleEndian(int32_t value);
int32_t modm::math::mac(int32_t result, int16_t a, int16_t b);
int32_t modm::math::mul(int16_t a, int16_t b);
int32_t modm::toBigEndian(int32_t value);
int32_t modm::toLittleEndian(int32_t value);
std::size_t modm::bitCount(uint16_t n);
std::size_t modm::bitCount(uint32_t n);
std::size_t modm::bitCount(uint8_t n);
uint16_t modm::bitReverse(uint16_t n);
uint16_t modm::fromBigEndian(uint16_t value);
uint16_t modm::fromLittleEndian(uint16_t value);
uint16_t modm::math::sqrt(uint32_t a);
uint16_t modm::swap(uint16_t n);
uint16_t modm::toBigEndian(uint16_t value);
uint16_t modm::toLittleEndian(uint16_t value);
uint16_t modm__sqrt32(uint32_t a);
uint32_t modm::bitReverse(uint32_t n);
uint32_t modm::fromBigEndian(uint32_t value);
uint32_t modm::fromLittleEndian(uint32_t value);
uint32_t modm::math::mul(uint16_t a, uint16_t b);
uint32_t modm::swap(uint32_t n);
uint32_t modm::toBigEndian(uint32_t value);
uint32_t modm::toLittleEndian(uint32_t value);
uint8_t modm::bitReverse(uint8_t n);
uint8_t modm::swap(uint8_t n);
void modm::swap(int16_t &a, int16_t &b);
void modm::swap(uint8_t &a, uint8_t &b);

// Variable
constexpr uint16_t modm::Bit10 = (1ul << 10);
constexpr uint16_t modm::Bit11 = (1ul << 11);
constexpr uint16_t modm::Bit12 = (1ul << 12);
constexpr uint16_t modm::Bit13 = (1ul << 13);
constexpr uint16_t modm::Bit14 = (1ul << 14);
constexpr uint16_t modm::Bit15 = (1ul << 15);
constexpr uint16_t modm::Bit8 = (1ul <<  8);
constexpr uint16_t modm::Bit9 = (1ul <<  9);
constexpr uint32_t modm::Bit16 = (1ul << 16);
constexpr uint32_t modm::Bit17 = (1ul << 17);
constexpr uint32_t modm::Bit18 = (1ul << 18);
constexpr uint32_t modm::Bit19 = (1ul << 19);
constexpr uint32_t modm::Bit20 = (1ul << 20);
constexpr uint32_t modm::Bit21 = (1ul << 21);
constexpr uint32_t modm::Bit22 = (1ul << 22);
constexpr uint32_t modm::Bit23 = (1ul << 23);
constexpr uint32_t modm::Bit24 = (1ul << 24);
constexpr uint32_t modm::Bit25 = (1ul << 25);
constexpr uint32_t modm::Bit26 = (1ul << 26);
constexpr uint32_t modm::Bit27 = (1ul << 27);
constexpr uint32_t modm::Bit28 = (1ul << 28);
constexpr uint32_t modm::Bit29 = (1ul << 29);
constexpr uint32_t modm::Bit30 = (1ul << 30);
constexpr uint32_t modm::Bit31 = (1ul << 31);
constexpr uint8_t modm::Bit0 = (1ul <<  0);
constexpr uint8_t modm::Bit1 = (1ul <<  1);
constexpr uint8_t modm::Bit2 = (1ul <<  2);
constexpr uint8_t modm::Bit3 = (1ul <<  3);
constexpr uint8_t modm::Bit4 = (1ul <<  4);
constexpr uint8_t modm::Bit5 = (1ul <<  5);
constexpr uint8_t modm::Bit6 = (1ul <<  6);
constexpr uint8_t modm::Bit7 = (1ul <<  7);

// Typedef
using modm::SignedType = typedef typename detail::MakeSigned<T>::type;
using modm::UnsignedType = typedef typename detail::MakeUnsigned<T>::type;
using modm::WideType = typedef typename detail::WideType<T>::type;


modm:math:utils modm_math_utils modm: math: utils modm_architecture modm: architecture modm_math_utils->modm_architecture modm_math modm: math modm_math_utils->modm_math modm_architecture_assert modm: architecture: assert modm_architecture_assert->modm_math_utils modm_architecture_gpio_expander modm: architecture: gpio.expander modm_architecture_gpio_expander->modm_math_utils modm_architecture_i2c_multiplexer modm: architecture: i2c.multiplexer modm_architecture_i2c_multiplexer->modm_math_utils modm_architecture_register modm: architecture: register modm_architecture_register->modm_math_utils modm_board_disco_f469ni modm: board: disco-f469ni modm_board_disco_f469ni->modm_math_utils modm_communication_xpcc modm: communication: xpcc modm_communication_xpcc->modm_math_utils modm_driver_ad7280a modm: driver: ad7280a modm_driver_ad7280a->modm_math_utils modm_driver_adc_sampler modm: driver: adc_sampler modm_driver_adc_sampler->modm_math_utils modm_driver_ams5915 modm: driver: ams5915 modm_driver_ams5915->modm_math_utils modm_driver_bme280 modm: driver: bme280 modm_driver_bme280->modm_math_utils modm_driver_bmp085 modm: driver: bmp085 modm_driver_bmp085->modm_math_utils modm_driver_hclax modm: driver: hclax modm_driver_hclax->modm_math_utils modm_driver_hmc58x modm: driver: hmc58x modm_driver_hmc58x->modm_math_utils modm_driver_hmc6343 modm: driver: hmc6343 modm_driver_hmc6343->modm_math_utils modm_driver_itg3200 modm: driver: itg3200 modm_driver_itg3200->modm_math_utils modm_driver_l3gd20 modm: driver: l3gd20 modm_driver_l3gd20->modm_math_utils modm_driver_lis3dsh modm: driver: lis3dsh modm_driver_lis3dsh->modm_math_utils modm_driver_lsm303a modm: driver: lsm303a modm_driver_lsm303a->modm_math_utils modm_driver_nrf24 modm: driver: nrf24 modm_driver_nrf24->modm_math_utils modm_driver_pca9535 modm: driver: pca9535 modm_driver_pca9535->modm_math_utils modm_driver_tmp102 modm: driver: tmp102 modm_driver_tmp102->modm_math_utils modm_driver_vl6180 modm: driver: vl6180 modm_driver_vl6180->modm_math_utils modm_io modm: io modm_io->modm_math_utils modm_math_filter modm: math: filter modm_math_filter->modm_math_utils modm_math_geometry modm: math: geometry modm_math_geometry->modm_math_utils modm_math_interpolation modm: math: interpolation modm_math_interpolation->modm_math_utils modm_math_saturated modm: math: saturated modm_math_saturated->modm_math_utils modm_platform_gpio modm: platform: gpio modm_platform_gpio->modm_math_utils modm_processing_timer modm: processing: timer modm_processing_timer->modm_math_utils modm_ui_animation modm: ui: animation modm_ui_animation->modm_math_utils modm_ui_color modm: ui: color modm_ui_color->modm_math_utils modm_ui_display modm: ui: display modm_ui_display->modm_math_utils