MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / pnInit

Method pnInit

Libraries/unrar/rs.cpp:39–60  ·  view source on GitHub ↗

Create the generator polynomial g(x). g(x)=(x-a)(x-a^2)(x-a^3)..(x-a^N)

Source from the content-addressed store, hash-verified

37// Create the generator polynomial g(x).
38// g(x)=(x-a)(x-a^2)(x-a^3)..(x-a^N)
39void RSCoder::pnInit()
40{
41 int p2[MAXPAR+1]; // Currently calculated part of g(x).
42
43 Clean(p2,ParSize);
44 p2[0]=1; // Set p2 polynomial to 1.
45
46 for (int I=1;I<=ParSize;I++)
47 {
48 int p1[MAXPAR+1]; // We use p1 as current (x+a^i) expression.
49 Clean(p1,ParSize);
50 p1[0]=gfExp[I];
51 p1[1]=1; // Set p1 polynomial to x+a^i.
52
53 // Multiply the already calucated part of g(x) to next (x+a^i).
54 pnMult(p1,p2,GXPol);
55
56 // p2=g(x).
57 for (int J=0;J<ParSize;J++)
58 p2[J]=GXPol[J];
59 }
60}
61
62
63// Multiply polynomial 'p1' to 'p2' and store the result in 'r'.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected