Loading [MathJax]/jax/input/TeX/config.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
GlobalSim::ap_int< n_dig, T > Struct Template Reference

#include <ap_int.h>

Collaboration diagram for GlobalSim::ap_int< n_dig, T >:

Public Member Functions

 ap_int ()=default
 
 ap_int (const double d)
 
 operator int () const
 
const ap_int operator+ (const ap_int &f) const
 
const ap_intoperator+= (const ap_int &f)
 
ap_int operator- (const ap_int &f) const
 
const ap_intoperator-= (const ap_int &f)
 
ap_int operator* (const ap_int &f) const
 
const ap_intoperator*= (const ap_int &f)
 
ap_int operator/ (const ap_int &f) const
 
const ap_intoperator/= (const ap_int &f)
 
ap_int operator- () const
 
void test_overflow ()
 

Static Public Member Functions

static ap_int form (T v)
 

Public Attributes

m_value {0}
 
bool m_ovflw {false}
 

Detailed Description

template<std::size_t n_dig, typename T = int16_t>
struct GlobalSim::ap_int< n_dig, T >

Definition at line 23 of file ap_int.h.

Constructor & Destructor Documentation

◆ ap_int() [1/2]

template<std::size_t n_dig, typename T = int16_t>
GlobalSim::ap_int< n_dig, T >::ap_int ( )
default

◆ ap_int() [2/2]

template<std::size_t n_dig, typename T = int16_t>
GlobalSim::ap_int< n_dig, T >::ap_int ( const double  d)
inline

Definition at line 30 of file ap_int.h.

30  {
31  m_value = T(d + (d >= 0 ? 0.5 : -0.5));
32  test_overflow();
33  }

Member Function Documentation

◆ form()

template<std::size_t n_dig, typename T = int16_t>
static ap_int GlobalSim::ap_int< n_dig, T >::form ( v)
inlinestatic

Definition at line 40 of file ap_int.h.

40  {
41  ap_int k; k.m_value = v; k.test_overflow(); return k;
42  }

◆ operator int()

template<std::size_t n_dig, typename T = int16_t>
GlobalSim::ap_int< n_dig, T >::operator int ( ) const
inline

Definition at line 35 of file ap_int.h.

35  {
36  return m_value;
37  }

◆ operator*()

template<std::size_t n_dig, typename T = int16_t>
ap_int GlobalSim::ap_int< n_dig, T >::operator* ( const ap_int< n_dig, T > &  f) const
inline

Definition at line 66 of file ap_int.h.

66  {
67  return form((WS(this->m_value) * WS(f.m_value)));
68  }

◆ operator*=()

template<std::size_t n_dig, typename T = int16_t>
const ap_int& GlobalSim::ap_int< n_dig, T >::operator*= ( const ap_int< n_dig, T > &  f)
inline

Definition at line 70 of file ap_int.h.

70  {
71  this->m_value -= (WS(this->m_value) * WS(f.m_value));
72  test_overflow();
73  return *this;
74  }

◆ operator+()

template<std::size_t n_dig, typename T = int16_t>
const ap_int GlobalSim::ap_int< n_dig, T >::operator+ ( const ap_int< n_dig, T > &  f) const
inline

Definition at line 44 of file ap_int.h.

44  {
45  return form(this->m_value + f.m_value);
46  }

◆ operator+=()

template<std::size_t n_dig, typename T = int16_t>
const ap_int& GlobalSim::ap_int< n_dig, T >::operator+= ( const ap_int< n_dig, T > &  f)
inline

Definition at line 49 of file ap_int.h.

49  {
50  this->m_value +=f.m_value;
51  test_overflow();
52  return *this;
53  }

◆ operator-() [1/2]

template<std::size_t n_dig, typename T = int16_t>
ap_int GlobalSim::ap_int< n_dig, T >::operator- ( ) const
inline

Definition at line 88 of file ap_int.h.

88  {
89  return form(-this->m_value);
90  }

◆ operator-() [2/2]

template<std::size_t n_dig, typename T = int16_t>
ap_int GlobalSim::ap_int< n_dig, T >::operator- ( const ap_int< n_dig, T > &  f) const
inline

Definition at line 55 of file ap_int.h.

55  {
56  return form(this->m_value - f.m_value);
57  }

◆ operator-=()

template<std::size_t n_dig, typename T = int16_t>
const ap_int& GlobalSim::ap_int< n_dig, T >::operator-= ( const ap_int< n_dig, T > &  f)
inline

Definition at line 60 of file ap_int.h.

60  {
61  this->m_value -= f.m_value;
62  test_overflow();
63  return *this;
64  }

◆ operator/()

template<std::size_t n_dig, typename T = int16_t>
ap_int GlobalSim::ap_int< n_dig, T >::operator/ ( const ap_int< n_dig, T > &  f) const
inline

Definition at line 77 of file ap_int.h.

77  {
78  return form((WS(this->m_value)) / WS(f.m_value));
79  }

◆ operator/=()

template<std::size_t n_dig, typename T = int16_t>
const ap_int& GlobalSim::ap_int< n_dig, T >::operator/= ( const ap_int< n_dig, T > &  f)
inline

Definition at line 81 of file ap_int.h.

81  {
82  this->m_value /= ((WS(this->m_value)) / WS(f.m_value));
83  test_overflow();
84  return *this;
85  }

◆ test_overflow()

template<std::size_t n_dig, typename T = int16_t>
void GlobalSim::ap_int< n_dig, T >::test_overflow ( )
inline

Definition at line 92 of file ap_int.h.

92  {
93  auto val = m_value >= 0 ? m_value : -m_value;
94 
95  if (val > (1<< n_dig)) {
96  m_ovflw=true;
97  throw std::runtime_error("ap_int overflow " + std::to_string(m_value));
98  }
99  }

Member Data Documentation

◆ m_ovflw

template<std::size_t n_dig, typename T = int16_t>
bool GlobalSim::ap_int< n_dig, T >::m_ovflw {false}

Definition at line 26 of file ap_int.h.

◆ m_value

template<std::size_t n_dig, typename T = int16_t>
T GlobalSim::ap_int< n_dig, T >::m_value {0}

Definition at line 24 of file ap_int.h.


The documentation for this struct was generated from the following file:
hist_file_dump.d
d
Definition: hist_file_dump.py:143
GlobalSim::ap_int::m_ovflw
bool m_ovflw
Definition: ap_int.h:26
hist_file_dump.f
f
Definition: hist_file_dump.py:141
GlobalSim::ap_int::test_overflow
void test_overflow()
Definition: ap_int.h:92
GlobalSim::ap_int::ap_int
ap_int()=default
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
GlobalSim::ap_int::form
static ap_int form(T v)
Definition: ap_int.h:40
python.PyAthena.v
v
Definition: PyAthena.py:154
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
GlobalSim::ap_int::m_value
T m_value
Definition: ap_int.h:24
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
fitman.k
k
Definition: fitman.py:528