Create the generator polynomial g(x). g(x)=(x-a)(x-a^2)(x-a^3)..(x-a^N)
| 37 | // Create the generator polynomial g(x). |
| 38 | // g(x)=(x-a)(x-a^2)(x-a^3)..(x-a^N) |
| 39 | void 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'. |
nothing calls this directly
no outgoing calls
no test coverage detected