> Please, is there here some good soul that understand this > functions hi8 and lo8 (from GCC AVR) and can help me to port it to > Python? > > uint16_t > crc_ccitt_update (uint16_t crc, uint8_t data) > { > data ˆ= lo8 (crc); > data ˆ= data << 4; > return ((((uint16_t)data << 8) | hi8 (crc)) ˆ (uint8_t)(data >> 4) > ˆ ((uint16_t)data << 3)); > }
Most likely, lo8(crc) == crc & 0xFF, and hi8(crc) == (crc >> 8) & 0xFF (the last bit masking might be redundant, as crc should not occupy more than 16 bits, anyway). HTH, Martin -- http://mail.python.org/mailman/listinfo/python-list