src/lib/zint/reedsol.c
void rs_init_code(int nsym, int index)
{
	int i, k;

	rspoly = (int *)malloc(sizeof(int) * (nsym + 1));

	rlen = nsym;

	rspoly[0] = 1;
	for (i = 1; i <= nsym; i++) {
		rspoly[i] = 1;
		for (k = i - 1; k > 0; k--) {
			if (rspoly[k])
				rspoly[k] = alog[(logt[rspoly[k]] + index) % logmod];
			rspoly[k] ^= rspoly[k - 1];
		}
		rspoly[0] = alog[(logt[rspoly[0]] + index) % logmod];
		index++;
	}
}
// rs_init_code(nsym, index) initialises the Reed-Solomon encoder
// nsym is the number of symbols to be generated (to be appended
// to the input data).  index is usually 1 - it is the index of
// the constant in the first term (i) of the RS generator polynomial:
// (x + 2**i)*(x + 2**(i+1))*...   [nsym terms]
// For ECC200, index is 1.
rs_init_code(nsym, index) initialises the Reed-Solomon encoder
nsym is the number of symbols to be generated (to be appended
to the input data).
rs_init_code ( nsym index ) initialises the Reed - Solomon encoder nsym is the number of symbols to be generated ( to be appended to the input data ) .
void rs_init_code(int nsym, int index)
{
	int i, k;
	rspoly = (int *)malloc(sizeof(int) * (nsym + 1));
	rlen = nsym;
	rspoly[0] = 1;
	for (i = 1; i <= nsym; i++) {
		rspoly[i] = 1;
		for (k = i - 1; k > 0; k--) {
			if (rspoly[k])
				rspoly[k] = alog[(logt[rspoly[k]] + index) % logmod];
			rspoly[k] ^= rspoly[k - 1];
		}
		rspoly[0] = alog[(logt[rspoly[0]] + index) % logmod];
		index++;
	}
}
void rs_init_code ( int nsym , int index ) { int i , k ; rspoly = ( int * ) malloc ( sizeof ( int ) * ( nsym + 1 ) ) ; rlen = nsym ; rspoly [ 0 ] = 1 ; for ( i = 1 ; i <= nsym ; i ++ ) { rspoly [ i ] = 1 ; for ( k = i - 1 ; k > 0 ; k -- ) { if ( rspoly [ k ] ) rspoly [ k ] = alog [ ( logt [ rspoly [ k ] ] + index ) % logmod ] ; rspoly [ k ] ^= rspoly [ k - 1 ] ; } rspoly [ 0 ] = alog [ ( logt [ rspoly [ 0 ] ] + index ) % logmod ] ; index ++ ; } }
rs_init_code(nsym, index) initialises the Reed-Solomon encoder
nsym is the number of symbols to be generated (to be appended
to the input data).
rs_init_code ( nsym index ) initialises the Reed - Solomon encoder nsym is the number of symbols to be generated ( to be appended to the input data ) .