storageCrcOuterCheckGenerator function

StorageOuterCheckSoftwareGenerator storageCrcOuterCheckGenerator(
  1. CrcConfiguration configuration, {
  2. required int dataWidth,
})

Creates a software outer-check generator from configuration.

Each page segment is treated as one packed CRC beat. The block index is intentionally not folded into the CRC; callers that need block-address binding can supply a custom StorageOuterCheckSoftwareGenerator.

Implementation

StorageOuterCheckSoftwareGenerator storageCrcOuterCheckGenerator(
  CrcConfiguration configuration, {
  required int dataWidth,
}) {
  if (dataWidth < 1) {
    throw ArgumentError.value(dataWidth, 'dataWidth', 'Must be positive.');
  }
  return (data, blockIndex) => configuration.finalize(
        configuration.advance(
          configuration.initialValue,
          data,
          beatWidth: dataWidth,
        ),
      );
}