- int m,
- b,
- p,
- v;
-
- // Return storage from previous setup
- if (log)
- {
- free (log);
- free (alog);
- free (rspoly);
- rspoly = NULL;
- }
- // Find the top bit, and hence the symbol size
- for (b = 1, m = 0; b <= poly; b <<= 1)
- m++;
- b >>= 1;
- m--;
- gfpoly = poly;
- symsize = m;
-
- // Calculate the log/alog tables
- logmod = (1 << m) - 1;
- log = (int *) malloc (sizeof (int) * (logmod + 1));
- alog = (int *) malloc (sizeof (int) * logmod);
-
- for (p = 1, v = 0; v < logmod; v++)
- {
- alog[v] = p;
- log[p] = v;
- p <<= 1;
- if (p & b)
- p ^= poly;
- }
+ int m, b, p, v;
+
+ // Return storage from previous setup
+ if (log) {
+ free(log);
+ free(alog);
+ free(rspoly);
+ rspoly = NULL;
+ }
+ // Find the top bit, and hence the symbol size
+ for (b = 1, m = 0; b <= poly; b <<= 1)
+ m++;
+ b >>= 1;
+ m--;
+ gfpoly = poly;
+ symsize = m;
+
+ // Calculate the log/alog tables
+ logmod = (1 << m) - 1;
+ log = (int *)malloc(sizeof(int) * (logmod + 1));
+ alog = (int *)malloc(sizeof(int) * logmod);
+
+ for (p = 1, v = 0; v < logmod; v++) {
+ alog[v] = p;
+ log[p] = v;
+ p <<= 1;
+ if (p & b)
+ p ^= poly;
+ }