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 59 of file libminifloat.h.

Constructor & Destructor Documentation

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

Definition at line 61 of file libminifloat.h.

Referenced by MiniFloatConverter::reduceMantissaToNbitsRounding().

61  :
62  shift(23-bits), mask((0xFFFFFFFF >> (shift)) << (shift)),
63  test(1 << (shift-1)), maxn((1<<bits)-2) {
64  assert(bits <= 23); // "max mantissa size is 23 bits"
65  }
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 66 of file libminifloat.h.

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

66  {
67  constexpr uint32_t low23 = (0x007FFFFF); // mask to keep lowest 23 bits = mantissa
68  constexpr uint32_t hi9 = (0xFF800000); // mask to keep highest 9 bits = the rest
69  union { float flt; uint32_t i32; } conv;
70  conv.flt=f;
71  if (conv.i32 & test) { // need to round
72  uint32_t mantissa = (conv.i32 & low23) >> shift;
73  if (mantissa < maxn) mantissa++;
74  conv.i32 = (conv.i32 & hi9) | (mantissa << shift);
75  } else {
76  conv.i32 &= mask;
77  }
78  return conv.flt;
79  }
static HepMC::IO_HEPEVT conv
double f[11][100]
#define constexpr

Member Data Documentation

const uint32_t MiniFloatConverter::ReduceMantissaToNbitsRounding::mask
private

Definition at line 82 of file libminifloat.h.

Referenced by operator()().

const uint32_t MiniFloatConverter::ReduceMantissaToNbitsRounding::maxn
private

Definition at line 82 of file libminifloat.h.

Referenced by operator()().

const int MiniFloatConverter::ReduceMantissaToNbitsRounding::shift
private

Definition at line 81 of file libminifloat.h.

Referenced by operator()().

const uint32_t MiniFloatConverter::ReduceMantissaToNbitsRounding::test
private