src
Public Member Functions | Static Public Member Functions | Friends | List of all members
u32lim_t< LIMIT > Class Template Reference

#include <u32lim.h>

Public Member Functions

uint32_t uint32 () const
 
bool overflow () const
 

Static Public Member Functions

static u32lim_t from32 (uint32_t x)
 
static u32lim_t from64 (uint64_t x)
 
static u32lim_t limit ()
 

Friends

u32lim_t operator+ (u32lim_t x, u32lim_t y)
 
u32lim_t operator* (u32lim_t x, u32lim_t y)
 
bool operator< (u32lim_t x, u32lim_t y)
 

Detailed Description

template<uint32_t LIMIT>
class u32lim_t< LIMIT >

Definition at line 11 of file u32lim.h.

Member Function Documentation

template<uint32_t LIMIT>
static u32lim_t u32lim_t< LIMIT >::from32 ( uint32_t  x)
inlinestatic

Definition at line 28 of file u32lim.h.

28 { return u32lim_t(x); }

Here is the caller graph for this function:

template<uint32_t LIMIT>
static u32lim_t u32lim_t< LIMIT >::from64 ( uint64_t  x)
inlinestatic

Definition at line 29 of file u32lim.h.

29 { return u32lim_t(x); }

Here is the caller graph for this function:

template<uint32_t LIMIT>
static u32lim_t u32lim_t< LIMIT >::limit ( )
inlinestatic

Definition at line 31 of file u32lim.h.

32  {
33  return u32lim_t (LIMIT);
34  }
template<uint32_t LIMIT>
bool u32lim_t< LIMIT >::overflow ( ) const
inline

Definition at line 41 of file u32lim.h.

42  {
43  return value == LIMIT;
44  }

Here is the caller graph for this function:

template<uint32_t LIMIT>
uint32_t u32lim_t< LIMIT >::uint32 ( ) const
inline

Definition at line 36 of file u32lim.h.

37  {
38  return value;
39  }

Here is the caller graph for this function:

Friends And Related Function Documentation

template<uint32_t LIMIT>
u32lim_t operator* ( u32lim_t< LIMIT >  x,
u32lim_t< LIMIT >  y 
)
friend

Definition at line 56 of file u32lim.h.

57  {
58  const uint64_t z
59  = static_cast<uint64_t> (x.value)
60  * static_cast<uint64_t> (y.value);
61  return z < LIMIT
62  ? u32lim_t (z)
63  : u32lim_t (LIMIT);
64  }
template<uint32_t LIMIT>
u32lim_t operator+ ( u32lim_t< LIMIT >  x,
u32lim_t< LIMIT >  y 
)
friend

Definition at line 46 of file u32lim.h.

47  {
48  const uint64_t z
49  = static_cast<uint64_t> (x.value)
50  + static_cast<uint64_t> (y.value);
51  return z < LIMIT
52  ? u32lim_t (z)
53  : u32lim_t (LIMIT);
54  }
template<uint32_t LIMIT>
bool operator< ( u32lim_t< LIMIT >  x,
u32lim_t< LIMIT >  y 
)
friend

Definition at line 66 of file u32lim.h.

67  {
68  return x.value < y.value;
69  }

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