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-2026 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):
12
13#include <cstdint>
14
15
16
17namespace CxxUtils {
18
32
33 public:
35 FloatCompressor( unsigned int mantissaBits = 7 );
36
38 float reduceFloatPrecision( float value ) const;
39
40
41 private:
43 unsigned int m_mantissaBits{};
46
49
50 // Half of the LSB-value after cutting the lower 32 - Ntotal bits
51 uint32_t m_rounding{};
53 uint32_t m_vmax{};
54
56
57 }; // class FloatCompressor
58
59} // namespace CxxUtils
60
61#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.