"Fossies" - the Fresh Open Source Software Archive

Member "unrar/rs.hpp" (4 May 2022, 819 Bytes) of package /linux/misc/unrarsrc-6.1.7.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "rs.hpp" see the Fossies "Dox" file reference documentation.

    1 #ifndef _RAR_RS_
    2 #define _RAR_RS_
    3 
    4 #define MAXPAR 255 // Maximum parity data size.
    5 #define MAXPOL 512 // Maximum polynomial degree.
    6 
    7 class RSCoder
    8 {
    9   private:
   10     void gfInit();
   11     int gfMult(int a,int b);
   12     void pnInit();
   13     void pnMult(int *p1,int *p2,int *r);
   14 
   15     int gfExp[MAXPOL];   // Galois field exponents.
   16     int gfLog[MAXPAR+1]; // Galois field logarithms.
   17 
   18     int GXPol[MAXPOL*2]; // Generator polynomial g(x).
   19 
   20     int ErrorLocs[MAXPAR+1],ErrCount;
   21     int Dnm[MAXPAR+1];
   22 
   23     int ParSize; // Parity bytes size and so the number of recovery volumes.
   24     int ELPol[MAXPOL]; // Error locator polynomial.
   25     bool FirstBlockDone;
   26   public:
   27     void Init(int ParSize);
   28     void Encode(byte *Data,int DataSize,byte *DestData);
   29     bool Decode(byte *Data,int DataSize,int *EraLoc,int EraSize);
   30 };
   31 
   32 #endif