InferenceNumericFormat.fixedPoint constructor

InferenceNumericFormat.fixedPoint({
  1. required bool signed,
  2. required int integerWidth,
  3. required int fractionWidth,
  4. int? productWidth,
  5. int? accumulatorWidth,
  6. NumericRoundingMode roundingMode = NumericRoundingMode.nearestEven,
  7. NumericOverflowMode overflowMode = NumericOverflowMode.saturate,
})

Creates a fixed-point inference format.

Implementation

factory InferenceNumericFormat.fixedPoint({
  required bool signed,
  required int integerWidth,
  required int fractionWidth,
  int? productWidth,
  int? accumulatorWidth,
  NumericRoundingMode roundingMode = NumericRoundingMode.nearestEven,
  NumericOverflowMode overflowMode = NumericOverflowMode.saturate,
}) {
  final elementWidth = integerWidth + fractionWidth + (signed ? 1 : 0);
  final resolvedProductWidth = productWidth ?? elementWidth * 2;
  return InferenceNumericFormat(
    elementKind: InferenceElementKind.fixedPoint,
    elementWidth: elementWidth,
    productWidth: resolvedProductWidth,
    accumulatorWidth: accumulatorWidth ?? resolvedProductWidth,
    signed: signed,
    integerWidth: integerWidth,
    fractionWidth: fractionWidth,
    roundingMode: roundingMode,
    overflowMode: overflowMode,
  );
}