6 : exponentBits_(conf.getParameter<uint32_t>(
"exponentBits")),
7 mantissaBits_(conf.getParameter<uint32_t>(
"mantissaBits")),
8 truncationBits_(conf.getParameter<uint32_t>(
"truncationBits")),
9 rounding_(conf.getParameter<
bool>(
"rounding")) {
11 throw cms::Exception(
"CodespaceCannotFit") <<
"The code space cannot fit into the unsigned 32-bit space.\n";
20 uint32_t& compressedCode,
21 uint32_t& compressedValue)
const {
32 uint32_t valcopy = shifted_value;
33 for (bitlen = 0; valcopy != 0; valcopy >>= 1, bitlen++) {
36 compressedCode = shifted_value;
50 compressedCode = floatval;
53 const bool roundup = ((shifted_value >> (
exponent - 2)) & 1) == 1;
55 compressedCode = floatval;
58 compressedCode = floatval + 1;
59 uint32_t rmantissa = mantissa + 1;
65 compressedValue = ((1 <<
mantissaBits_) | rmantissa) << (rexponent - 1);
72 std::unordered_map<uint32_t, std::array<uint32_t, 2> >& compressed_payload) {
76 uint32_t compressed_value(0);
78 std::array<uint32_t, 2> compressed_item = {{code, compressed_value}};
79 compressed_payload.emplace(
item.first, compressed_item);
HGCalVFECompressionImpl(const edm::ParameterSet &conf)
void compressSingle(const uint32_t value, uint32_t &compressedCode, uint32_t &compressedValue) const
void compress(const std::unordered_map< uint32_t, uint32_t > &, std::unordered_map< uint32_t, std::array< uint32_t, 2 > > &)
uint32_t saturationValue_