reed_solomon_16::engine

Trait Engine

Source
pub trait Engine: Clone
where Self: Sized,
{ // Required methods fn fft( &self, data: &mut ShardsRefMut<'_>, pos: usize, size: usize, truncated_size: usize, skew_delta: usize, ); fn fwht(data: &mut [GfElement; 65536], truncated_size: usize); fn ifft( &self, data: &mut ShardsRefMut<'_>, pos: usize, size: usize, truncated_size: usize, skew_delta: usize, ); fn mul(&self, x: &mut [u8], log_m: GfElement); fn xor(x: &mut [u8], y: &[u8]); // Provided methods fn eval_poly(erasures: &mut [GfElement; 65536], truncated_size: usize) { ... } fn fft_skew_end( &self, data: &mut ShardsRefMut<'_>, pos: usize, size: usize, truncated_size: usize, ) { ... } fn formal_derivative(data: &mut ShardsRefMut<'_>) { ... } fn ifft_skew_end( &self, data: &mut ShardsRefMut<'_>, pos: usize, size: usize, truncated_size: usize, ) { ... } fn xor_within(data: &mut ShardsRefMut<'_>, x: usize, y: usize, count: usize) { ... } }
Expand description

Implementation of basic low-level algorithms needed for Reed-Solomon encoding/decoding.

These algorithms are not properly documented.

Naive engine is provided for those who want to study the source code to understand Engine.

Required Methods§

Source

fn fft( &self, data: &mut ShardsRefMut<'_>, pos: usize, size: usize, truncated_size: usize, skew_delta: usize, )

In-place decimation-in-time FFT (fast Fourier transform).

  • FFT is done on chunk data[pos .. pos + size]
  • size must be 2^n
  • Before function call data[pos .. pos + size] must be valid.
  • After function call
    • data[pos .. pos + truncated_size] contains valid FFT result.
    • data[pos + truncated_size .. pos + size] contains valid FFT result if this contained only 0u8:s and garbage otherwise.
Source

fn fwht(data: &mut [GfElement; 65536], truncated_size: usize)

In-place FWHT (fast Walsh-Hadamard transform).

Source

fn ifft( &self, data: &mut ShardsRefMut<'_>, pos: usize, size: usize, truncated_size: usize, skew_delta: usize, )

In-place decimation-in-time IFFT (inverse fast Fourier transform).

  • IFFT is done on chunk data[pos .. pos + size]
  • size must be 2^n
  • Before function call data[pos .. pos + size] must be valid.
  • After function call
    • data[pos .. pos + truncated_size] contains valid IFFT result.
    • data[pos + truncated_size .. pos + size] contains valid IFFT result if this contained only 0u8:s and garbage otherwise.
Source

fn mul(&self, x: &mut [u8], log_m: GfElement)

x[] *= log_m

Source

fn xor(x: &mut [u8], y: &[u8])

x[] ^= y[]

Provided Methods§

Source

fn eval_poly(erasures: &mut [GfElement; 65536], truncated_size: usize)

Evaluate polynomial.

Source

fn fft_skew_end( &self, data: &mut ShardsRefMut<'_>, pos: usize, size: usize, truncated_size: usize, )

FFT with skew_delta = pos + size.

Source

fn formal_derivative(data: &mut ShardsRefMut<'_>)

Formal derivative.

Source

fn ifft_skew_end( &self, data: &mut ShardsRefMut<'_>, pos: usize, size: usize, truncated_size: usize, )

IFFT with skew_delta = pos + size.

Source

fn xor_within(data: &mut ShardsRefMut<'_>, x: usize, y: usize, count: usize)

data[x .. x + count] ^= data[y .. y + count]

Ranges must not overlap.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§