Encoding lumi counter shift, multiplier, over and underflow

@dcraik @elniel @fferrari @balagura

Some counters calculated in Allen may not fit directly into an unsigned int N-bit representation. Some encoding is necessary in that case

  • to scale the dynamic range
  • to apply an offset
  • to preserve information about over- and under-flow.

If such encoding is done, should its parameters be preserved (as part of the en/decoding table). Should they be somehow used in the decoding? (How would one represent the underflow or overflow...)

See discussions from !1177 (merged)

  • @rmatev started a discussion: (+2 comments)

    It might be a good idea to be able to distinguish a genuine scaled_value == (1ul << size) - 1 from the overflow value. You can achieve this by changing to if(scaled_value >= (1ul << size) - 1).

    Same goes for the underflow but this one is less obvious.

  • @rmatev started a discussion:

    Is this shift guaranteed to be stable? Or put another way, do we need to version the shift/multiplier similarly to how the bit structure of the lumi summary is versioned?

Edited by Daniel Charles Craik