CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
MiniFloatConverter::ReduceMantissaToNbitsRounding Class Reference

#include <libminifloat.h>

Public Member Functions

float operator() (float f) const
 
 ReduceMantissaToNbitsRounding (int bits)
 

Private Attributes

const uint32_t mask
 
const uint32_t maxn
 
const int shift
 
const uint32_t test
 

Detailed Description

Definition at line 71 of file libminifloat.h.

Constructor & Destructor Documentation

MiniFloatConverter::ReduceMantissaToNbitsRounding::ReduceMantissaToNbitsRounding ( int  bits)
inline

Definition at line 73 of file libminifloat.h.

Referenced by MiniFloatConverter::reduceMantissaToNbitsRounding().

74  : shift(23 - bits), mask((0xFFFFFFFF >> (shift)) << (shift)), test(1 << (shift - 1)), maxn((1 << bits) - 2) {
75  assert(bits <= 23); // "max mantissa size is 23 bits"
76  }
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision bits

Member Function Documentation

float MiniFloatConverter::ReduceMantissaToNbitsRounding::operator() ( float  f) const
inline

Definition at line 77 of file libminifloat.h.

References constexpr, conv, f, mask, maxn, and shift.

77  {
78  constexpr uint32_t low23 = (0x007FFFFF); // mask to keep lowest 23 bits = mantissa
79  constexpr uint32_t hi9 = (0xFF800000); // mask to keep highest 9 bits = the rest
80  union {
81  float flt;
82  uint32_t i32;
83  } conv;
84  conv.flt = f;
85  if (conv.i32 & test) { // need to round
86  uint32_t mantissa = (conv.i32 & low23) >> shift;
87  if (mantissa < maxn)
88  mantissa++;
89  conv.i32 = (conv.i32 & hi9) | (mantissa << shift);
90  } else {
91  conv.i32 &= mask;
92  }
93  return conv.flt;
94  }
static HepMC::IO_HEPEVT conv
double f[11][100]
#define constexpr

Member Data Documentation

const uint32_t MiniFloatConverter::ReduceMantissaToNbitsRounding::mask
private

Definition at line 98 of file libminifloat.h.

Referenced by operator()().

const uint32_t MiniFloatConverter::ReduceMantissaToNbitsRounding::maxn
private

Definition at line 98 of file libminifloat.h.

Referenced by operator()().

const int MiniFloatConverter::ReduceMantissaToNbitsRounding::shift
private

Definition at line 97 of file libminifloat.h.

Referenced by operator()().

const uint32_t MiniFloatConverter::ReduceMantissaToNbitsRounding::test
private