ATLAS Offline Software
Loading...
Searching...
No Matches
FloatRep Class Reference

#include <ErrorMatrixCompressor.h>

Collaboration diagram for FloatRep:

Public Member Functions

 FloatRep (char s, unsigned short e, unsigned int m)
 ~FloatRep ()
float restore ()
char sign () const
unsigned short exponent () const
unsigned int mantissa () const
void sign (char s)
void exponent (unsigned short int e)
void mantissa (unsigned int m)

Private Attributes

char m_sign {}
std::uint32_t m_exp {}
std::uint32_t m_mant {}

Detailed Description

Definition at line 55 of file ErrorMatrixCompressor.h.

Constructor & Destructor Documentation

◆ FloatRep()

FloatRep::FloatRep ( char s,
unsigned short e,
unsigned int m )
inline

Definition at line 58 of file ErrorMatrixCompressor.h.

58 :
59 m_sign(s), m_exp(e), m_mant(m)
60 {
61
62 }
std::uint32_t m_mant
std::uint32_t m_exp

◆ ~FloatRep()

FloatRep::~FloatRep ( )
inline

Definition at line 63 of file ErrorMatrixCompressor.h.

63{};

Member Function Documentation

◆ exponent() [1/2]

unsigned short FloatRep::exponent ( ) const
inline

Definition at line 83 of file ErrorMatrixCompressor.h.

84 {
85 return m_exp;
86 }

◆ exponent() [2/2]

void FloatRep::exponent ( unsigned short int e)
inline

Definition at line 95 of file ErrorMatrixCompressor.h.

◆ mantissa() [1/2]

unsigned int FloatRep::mantissa ( ) const
inline

Definition at line 87 of file ErrorMatrixCompressor.h.

88 {
89 return m_mant;
90 }

◆ mantissa() [2/2]

void FloatRep::mantissa ( unsigned int m)
inline

Definition at line 99 of file ErrorMatrixCompressor.h.

100 {
101 m_mant=m;
102 }

◆ restore()

float FloatRep::restore ( )
inline

Definition at line 64 of file ErrorMatrixCompressor.h.

65 {
66
67
68 if((m_mant==0)&&(m_sign!=0))
69 return 0.0;
70
71 std::uint32_t buf=0x00000000u;
72
73 buf = m_mant;
74 buf = buf | (m_exp << 23);
75 if (m_sign!=0)
76 buf = buf | 0x80000000u;
77 return std::bit_cast<float>(buf);
78 }

◆ sign() [1/2]

char FloatRep::sign ( ) const
inline

Definition at line 79 of file ErrorMatrixCompressor.h.

80 {
81 return m_sign;
82 }

◆ sign() [2/2]

void FloatRep::sign ( char s)
inline

Definition at line 91 of file ErrorMatrixCompressor.h.

92 {
93 m_sign=(s==0)?0:1;
94 }

Member Data Documentation

◆ m_exp

std::uint32_t FloatRep::m_exp {}
private

Definition at line 106 of file ErrorMatrixCompressor.h.

106{};

◆ m_mant

std::uint32_t FloatRep::m_mant {}
private

Definition at line 107 of file ErrorMatrixCompressor.h.

107{};

◆ m_sign

char FloatRep::m_sign {}
private

Definition at line 105 of file ErrorMatrixCompressor.h.

105{};

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