ATLAS Offline Software
Loading...
Searching...
No Matches
FloatCompressor.h
Go to the documentation of this file.
1// Dear emacs, this is -*- c++ -*-
2
3/*
4 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
5*/
6
7// $Id: FloatCompressor.h 789425 2016-12-13 10:50:12Z krasznaa $
8#ifndef CXXUTILS_FLOATCOMPRESSOR_H
9#define CXXUTILS_FLOATCOMPRESSOR_H
10
11// System include(s):
12extern "C" {
13# include <stdint.h>
14}
15
16namespace CxxUtils {
17
31
32 public:
34 FloatCompressor( unsigned int mantissaBits = 7 );
35
37 float reduceFloatPrecision( float value ) const;
38
40 union floatint_t {
41 float fvalue;
42 uint32_t ivalue;
43 };
44
45 private:
47 unsigned int m_mantissaBits;
50
53
54 // Half of the LSB-value after cutting the lower 32 - Ntotal bits
55 uint32_t m_rounding;
57 uint32_t m_vmax;
58
60
61 }; // class FloatCompressor
62
63} // namespace CxxUtils
64
65#endif // CXXUTILS_FLOATCOMPRESSOR_H
unsigned int m_mantissaBits
Number of mantissa bits to keep.
uint32_t m_vmax
Largest possible positive 32bit float minus the rounding.
uint32_t m_mantissaBitmask
Bitmask for zeroing out the non-interesting bits.
float reduceFloatPrecision(float value) const
Function returning a reduced precision float value.
FloatCompressor(unsigned int mantissaBits=7)
Constructor with the number of mantissa bits to retain.
Type used in the compression.