CompactedLanes<LogicType extends Logic> constructor

CompactedLanes<LogicType extends Logic>(
  1. TypedLogicArray<LogicType, LogicValue> lanes, {
  2. required int countWidth,
  3. String? name,
})

Creates a compacted lane payload.

Implementation

CompactedLanes(
  TypedLogicArray<LogicType, LogicValue> lanes, {
  required this.countWidth,
  String? name,
})  : laneCount = lanes.arrayElements.length,
      super(
        [
          lanes,
          Logic(name: 'validCount', width: countWidth),
          Logic(name: 'consumedMask', width: lanes.arrayElements.length),
        ],
        name: name ?? '${lanes.name}_compacted',
      ) {
  if (lanes.dimensions.length != 1 || countWidth < widthFor(laneCount + 1)) {
    throw ArgumentError(
      'Lanes must be one-dimensional and countWidth must represent every '
      'valid lane count.',
    );
  }
}