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
unsigned int m_exp
unsigned int m_mant

Detailed Description

Definition at line 63 of file ErrorMatrixCompressor.h.

Constructor & Destructor Documentation

◆ FloatRep()

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

Definition at line 66 of file ErrorMatrixCompressor.h.

66 :
67 m_sign(s), m_exp(e), m_mant(m)
68 {
69
70 }
unsigned int m_mant
unsigned int m_exp

◆ ~FloatRep()

FloatRep::~FloatRep ( )
inline

Definition at line 71 of file ErrorMatrixCompressor.h.

71{};

Member Function Documentation

◆ exponent() [1/2]

unsigned short FloatRep::exponent ( ) const
inline

Definition at line 95 of file ErrorMatrixCompressor.h.

96 {
97 return m_exp;
98 }

◆ exponent() [2/2]

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

Definition at line 107 of file ErrorMatrixCompressor.h.

◆ mantissa() [1/2]

unsigned int FloatRep::mantissa ( ) const
inline

Definition at line 99 of file ErrorMatrixCompressor.h.

100 {
101 return m_mant;
102 }

◆ mantissa() [2/2]

void FloatRep::mantissa ( unsigned int m)
inline

Definition at line 111 of file ErrorMatrixCompressor.h.

112 {
113 m_mant=m;
114 }

◆ restore()

float FloatRep::restore ( )
inline

Definition at line 72 of file ErrorMatrixCompressor.h.

73 {
74 union FL {
75 float m_f;
76 unsigned int m_l;
77 } decoder;
78
79 if((m_mant==0)&&(m_sign!=0))
80 return 0.0;
81
82 unsigned int buf=0x00000000;
83
84 buf = m_mant;
85 buf = buf | (m_exp << 23);
86 if (m_sign!=0)
87 buf = buf | 0x80000000;
88 decoder.m_l=buf;
89 return decoder.m_f;
90 }

◆ sign() [1/2]

char FloatRep::sign ( ) const
inline

Definition at line 91 of file ErrorMatrixCompressor.h.

92 {
93 return m_sign;
94 }

◆ sign() [2/2]

void FloatRep::sign ( char s)
inline

Definition at line 103 of file ErrorMatrixCompressor.h.

104 {
105 m_sign=(s==0)?0:1;
106 }

Member Data Documentation

◆ m_exp

unsigned int FloatRep::m_exp
private

Definition at line 118 of file ErrorMatrixCompressor.h.

◆ m_mant

unsigned int FloatRep::m_mant
private

Definition at line 119 of file ErrorMatrixCompressor.h.

◆ m_sign

char FloatRep::m_sign
private

Definition at line 117 of file ErrorMatrixCompressor.h.


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