public void Update(long?val, long valMax) { AssertValid(valMax); Contracts.Assert(!val.HasValue || -valMax <= val && val <= valMax); if (!val.HasValue) { _cna++; } else if (val >= 0) { IntUtils.Add(ref _sumHi, ref _sumLo, (ulong)val); } else { IntUtils.Sub(ref _sumHi, ref _sumLo, (ulong)(-val)); } AssertValid(valMax); }