- uint64_t OtherCount = Other.Counts[I];
- if (Weight > 1) {
- OtherCount = SaturatingMultiply(OtherCount, Weight, &Overflowed);
- if (Overflowed)
- Result = instrprof_error::counter_overflow;
- }
- Counts[I] = SaturatingAdd(Counts[I], OtherCount, &Overflowed);
+ Counts[I] =
+ SaturatingMultiplyAdd(Other.Counts[I], Weight, Counts[I], &Overflowed);