crc-8 and crc-16 code...

M

Mamut

Hello
Does have anybody procedures for:
CRC-8: polynomial x^8 + x^7 + x^2 + 1
i CRC-16: polynomial x^16 + x^15 + x^2 + 1
?
 
V

Victor Bazarov

Mamut said:
Does have anybody procedures for:
CRC-8: polynomial x^8 + x^7 + x^2 + 1
i CRC-16: polynomial x^16 + x^15 + x^2 + 1
?

Have you tried googling for those?
 
V

Victor Bazarov

Mamut said:
yes but for this polynomials I can't find...

If you just need to calculate polynomials, what's the problem?
Write a function that takes your argument and multiplies and
adds what you need. Example:

// 'n' = degree, 'a' = array of factors (sized n+1)
// 'x' = parameter
double polynomial(double x, double *a, size_t n)
{
double result = a[n];
while (n) {
result *= x;
result += a[--n];
}
return result;
}

Now, all you need is to define the proper arguments...

V
 
M

Mamut

If you just need to calculate polynomials, what's the problem?
Write a function that takes your argument and multiplies and

no, I need to calculate CRC sum based on these polinomials and I can't
do this.
 
V

Victor Bazarov

Mamut said:
no, I need to calculate CRC sum based on these polinomials and I can't
do this.

This sound like an admission of defeat. What seems to be the problem?
Do you have the algorithm? If yes, have you attempted to convert it
into C++ terms? If yes, do you get compiler errors? If yes, read the
FAQ 5.8. If you don't have the algorithm, we can't help you. Try
posting to comp.programming or search for it on the web. Once you
find the algorithm, try writing it down in C++ terms. If you don't
succeed (and how would you know unless the compiler complains, right?),
post what you have and the errors (IOW, follow the recommendations of
FAQ 5.8).

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top