12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #region Using
- #endregion
- namespace SharpCompress.Compressors.PPMd.I1
- {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- internal class See2Context
- {
- private const byte PERIOD_BIT_COUNT = 7;
- public ushort _summary;
- public byte _shift;
- public byte _count;
- public void Initialize(uint initialValue)
- {
- _shift = PERIOD_BIT_COUNT - 4;
- _summary = (ushort)(initialValue << _shift);
- _count = 7;
- }
- public uint Mean()
- {
- uint value = (uint)(_summary >> _shift);
- _summary = (ushort)(_summary - value);
- return (uint)(value + ((value == 0) ? 1 : 0));
- }
- public void Update()
- {
- if (_shift < PERIOD_BIT_COUNT && --_count == 0)
- {
- _summary += _summary;
- _count = (byte)(3 << _shift++);
- }
- }
- }
- }
|