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 directly.

Kent

>  
> """
> _uint16 ComCRC16(_uint8 val, _uint16 crc)
> {
>         _uint8 i;
>         _uint16 cval;
>  
>     for (i=0;i<8;i++)
>     {
>         if (((crc & 0x0001)^(val & 0x0001))!= 0)   crc = (crc >> 1)^ 
> CCITT_POLY;
>         else   crc >>= 1;
>         val >>= 1;
>     }
>     return crc
> }
>  
> """
>  
> Thanks
>  
> Johan
> 
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.432 / Virus Database: 268.17.25/669 - Release Date: 
> 2007/02/04 09:58 PM
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to