CppCommon  1.0.4.1
C++ Common Library
Public Member Functions | Static Public Member Functions | List of all members
CppCommon::Math Class Reference

Math static class. More...

#include <math.h>

Public Member Functions

 Math ()=delete
 
 Math (const Math &)=delete
 
 Math (Math &&)=delete
 
 ~Math ()=delete
 
Mathoperator= (const Math &)=delete
 
Mathoperator= (Math &&)=delete
 

Static Public Member Functions

template<typename T >
static T GCD (T a, T b)
 Computes the greatest common divisor of a and b. More...
 
template<typename T >
static T RoundUp (T a, T k)
 Finds the smallest value x >= a such that x % k == 0. More...
 
static uint64_t MulDiv64 (uint64_t operant, uint64_t multiplier, uint64_t divider)
 Calculate (operant * multiplier / divider) with 64-bit unsigned integer values. More...
 

Detailed Description

Math static class.

Contains useful math functions.

Thread-safe.

Definition at line 22 of file math.h.

Constructor & Destructor Documentation

◆ Math() [1/3]

CppCommon::Math::Math ( )
delete

◆ Math() [2/3]

CppCommon::Math::Math ( const Math )
delete

◆ Math() [3/3]

CppCommon::Math::Math ( Math &&  )
delete

◆ ~Math()

CppCommon::Math::~Math ( )
delete

Member Function Documentation

◆ GCD()

template<typename T >
static T CppCommon::Math::GCD ( a,
b 
)
static

Computes the greatest common divisor of a and b.

Parameters
a- Value a
b- Value b
Returns
Greatest common divisor of a and b

◆ MulDiv64()

uint64_t CppCommon::Math::MulDiv64 ( uint64_t  operant,
uint64_t  multiplier,
uint64_t  divider 
)
static

Calculate (operant * multiplier / divider) with 64-bit unsigned integer values.

Parameters
operant- Operant
multiplier- Multiplier
divider- Divider
Returns
Calculated value of (operant * multiplier / divider) expression
Examples
math_math.cpp.

Definition at line 17 of file math.cpp.

◆ operator=() [1/2]

Math& CppCommon::Math::operator= ( const Math )
delete

◆ operator=() [2/2]

Math& CppCommon::Math::operator= ( Math &&  )
delete

◆ RoundUp()

template<typename T >
T CppCommon::Math::RoundUp ( a,
k 
)
inlinestatic

Finds the smallest value x >= a such that x % k == 0.

Parameters
a- Value a
k- Value k
Returns
Value x

Definition at line 27 of file math.inl.


The documentation for this class was generated from the following files: