Re: [Tutor] CRC calculation with python

2007-02-06 Thread Johan Geldenhuys
February 2007 07:28 PM To: tutor@python.org Subject: Re: [Tutor] CRC calculation with python On Tue, Feb 06, 2007 at 12:10:36PM -0500, Chris Calloway wrote: > First, you need to find the preprocessor define for CCITT_POLY. The > code is incomplete without it. > > Second, where did th

Re: [Tutor] CRC calculation with python

2007-02-06 Thread Dave Kuhlman
On Tue, Feb 06, 2007 at 12:10:36PM -0500, Chris Calloway wrote: > First, you need to find the preprocessor define for CCITT_POLY. The code > is incomplete without it. > > Second, where did this code come from? It defines an unused local named > cval, which will usually cause at least a compilati

Re: [Tutor] CRC calculation with python

2007-02-06 Thread Chris Calloway
First, you need to find the preprocessor define for CCITT_POLY. The code is incomplete without it. Second, where did this code come from? It defines an unused local named cval, which will usually cause at least a compilation warning. This looks like a snippet, not a complete CCITT CRC calculati

Re: [Tutor] CRC calculation with python

2007-02-06 Thread Daniel Yoo
On Tue, 6 Feb 2007, Johan Geldenhuys wrote: > I'm not a C++ expert at all and I would like to find out if somebody can > explain to me how the statement below can be done in Python? > > """ > _uint16 ComCRC16(_uint8 val, _uint16 crc) > { >_uint8 i; >_uint16 cval; > >for (i=0

Re: [Tutor] CRC calculation with python

2007-02-06 Thread Kent Johnson
Johan Geldenhuys wrote: > Hi all, > > I'm not a C++ expert at all and I would like to find out if somebody can > explain to me how the statement below can be done in Python? I suggest you Google "Python CRC" and find out how others have done this, rather than trying to translate the code direc

[Tutor] CRC calculation with python

2007-02-06 Thread Johan Geldenhuys
Hi all, I'm not a C++ expert at all and I would like to find out if somebody can explain to me how the statement below can be done in Python? """ _uint16 ComCRC16(_uint8 val, _uint16 crc) { _uint8 i; _uint16 cval; for (i=0;i<8;i++) { if (((crc & 0x0001)^(val &