add method

FixedPoint add(
  1. dynamic other
)

Adds other and returns a full-precision FixedPoint.

Implementation

FixedPoint add(dynamic other) {
  final comparable = _verifyCompatible(other);
  final resultWidth = width + 1;
  final left = signed ? signExtend(resultWidth) : zeroExtend(resultWidth);
  final right = signed
      ? comparable.signExtend(resultWidth)
      : comparable.zeroExtend(resultWidth);
  return FixedPoint.of(left + right,
      signed: signed,
      integerWidth: integerWidth + 1,
      fractionWidth: fractionWidth);
}