|
ATLAS Offline Software
|
Go to the documentation of this file.
5 #ifndef GLOBALSIM_AP_FIXED_H
6 #define GLOBALSIM_AP_FIXED_H
29 template<std::
size_t w
idth,
typename T>
32 static_assert(8*
sizeof(
t) >=
width,
"ap_fixed underlying int to small");
33 for (std::size_t
i = 0;
i <=
sizeof(
t)*8-
width; ++
i){
42 template <std::size_t
width,
65 ap_fixed(
const double d) requires(std::is_same_v<S, Round>):
70 ap_fixed(
const double d) requires(std::is_same_v<S, XilDef>):
86 return form(this->m_value +
f.m_value);
91 this->m_value +=
f.m_value;
97 return form(this->m_value -
f.m_value);
102 this->m_value -=
f.m_value;
108 return form((WS(this->m_value) * WS(
f.m_value)) >>
dp);
112 this->m_value = (WS(this->m_value) * WS(
f.m_value) >>
dp);
119 return form((WS(this->m_value) <<
dp) / WS(
f.m_value));
123 this->m_value = ((WS(this->m_value) <<
dp) / WS(
f.m_value));
130 return form(-this->m_value);
146 std::stringstream
ss;
149 ss <<
"ap_fixed overflow. val: "
151 <<
' ' << std::hex <<
val
153 throw std::out_of_range(
ss.str());
ap_fixed operator/(const ap_fixed &f) const
const ap_fixed & operator*=(const ap_fixed &f)
ap_fixed operator-() const
constexpr T max_to_overflow()
setScaleOne setStatusOne setSaturated int16_t
friend std::ostream & operator<<(std::ostream &os, const ap_fixed< width, dp, S, T, WS > ap)
static ap_fixed form(T v)
ap_fixed operator*(const ap_fixed &f) const
AlgTool to obtain a selection of eFex RoIs read in from the event store.
ap_fixed(const double d) requires(std
static bool s_print_value
ATLAS_NO_CHECK_FILE_THREAD_SAFETY
static bool s_check_overflow
const ap_fixed & operator/=(const ap_fixed &f)
static constexpr T m_overflow_mask
const ap_fixed & operator-=(const ap_fixed &f)
const ap_fixed operator+(const ap_fixed &f) const
const ap_fixed & operator+=(const ap_fixed &f)
Define macros for attributes used to control the static checker.