libUTL++
Math

Mathematics. More...

Classes

class  utl::Bool
 Boolean value. More...
 
class  utl::Bytes
 Number of bytes. More...
 
class  utl::Char
 Character value. More...
 
class  utl::Decimal
 Fixed-point decimal number. More...
 
class  utl::Float
 Floating point number. More...
 
class  utl::Int
 32-bit signed integer. More...
 
class  utl::Integer< T >
 Integer value. More...
 
class  utl::Number< T >
 Numeric value. More...
 
class  utl::Span< T, D >
 Span of values. More...
 
class  utl::SpanSizeOrdering< T, D >
 Order spans by size. More...
 
class  utl::ObjectSpan< T, D >
 Span of object-derived objects. More...
 
class  utl::SpanAllocator< T, D >
 Span allocator. More...
 
class  utl::SpanCol< T, D >
 Span collection. More...
 
class  utl::Uint
 64-bit unsigned integer. More...
 

Enumerations

enum  utl::span_op_t { utl::span_overlaps, utl::span_contains, utl::span_contained_in }
 Span relationships. More...
 

Functions

uint32_t utl::nextPow2 (uint32_t n)
 Return the smallest power of 2 which is >= n.
 
uint64_t utl::nextPow2 (uint64_t n)
 Return the smallest power of 2 which is >= n.
 
template<class T >
utl::nextMultiple (const T &x, const T &target)
 Return the smallest number n s.t. More...
 
uint32_t utl::nextMultipleOfPow2 (uint32_t x, uint32_t target)
 Return the smallest number n s.t. More...
 
uint64_t utl::nextMultipleOfPow2 (uint64_t x, uint64_t target)
 Return the smallest number n s.t. More...
 
template<class T >
bool utl::isDivisibleBy (const T &x, const T &n)
 Determine whether x is evenly divisible by n. More...
 

Detailed Description

Mathematics.

Enumeration Type Documentation

◆ span_op_t

Span relationships.

Enumerator
span_overlaps 

span overlaps another

span_contains 

span contains another

span_contained_in 

span is contained by another

Definition at line 17 of file Span.h.

Function Documentation

◆ nextMultiple()

template<class T >
T utl::nextMultiple ( const T &  x,
const T &  target 
)
inline

Return the smallest number n s.t.

n is a multiple of x, and n >= target.

Definition at line 142 of file util_inl.h.

References ASSERTD.

Referenced by utl::Integer< uint64_t >::nextMultiple().

◆ nextMultipleOfPow2() [1/2]

uint32_t utl::nextMultipleOfPow2 ( uint32_t  x,
uint32_t  target 
)
inline

Return the smallest number n s.t.

n is a multiple of x (a power of 2), and n >= target.

Definition at line 158 of file util_inl.h.

References ASSERTD, and utl::nextPow2().

Referenced by utl::Vector< uint_t >::swap().

◆ nextMultipleOfPow2() [2/2]

uint64_t utl::nextMultipleOfPow2 ( uint64_t  x,
uint64_t  target 
)
inline

Return the smallest number n s.t.

n is a multiple of x (a power of 2), and n >= target.

Definition at line 174 of file util_inl.h.

References ASSERTD, and utl::nextPow2().

Referenced by utl::arrayGrow().

◆ isDivisibleBy()

template<class T >
bool utl::isDivisibleBy ( const T &  x,
const T &  n 
)
inline

Determine whether x is evenly divisible by n.

Returns
true if x divisible by n, false otherwise

Definition at line 711 of file util_inl.h.

Referenced by utl::Integer< uint64_t >::isDivisibleBy().