@amg6975, looks like tricore mnemonic, good.
0. clear low four (crc) bits in byte0 of canarray(6).
1. Crc int16 = 0x399, i = 0
2. crc = crc + canarray(i)
, i++, Loop i<6
3. Tmp = crc >>8 (ie crc 0x854 = tmp 0x08)
4. Crc = crc AND 0xFF (ie crc 0x854 = 0x54)
5. Crc = tmp + crc (just add low and high bytes of initial crc = 0x5C)
6. Tmp = crc >>4 (0x05)
7. Crc = crc AND 0xF (0x0C)
8. Crc = tmp + crc (0x11 sum of high and low quarter bits)
9. Crc = crc AND 0xF (crc = 0x01 to fit into 4 bits crc)
Example:
1. clear low (crc) bits in 0x89 = 0x80
2. Calculate sum of all new bytes = 0x16B
3. Add can id: 0x399 + 0x16B = 0x504
4. Add low and high bytes to byte = 0x09
5. Add low and high quarter bits in byte = 0x09
6. Mask low four bits: 0x9
7. Insert in crc field that four bits.
8. damn! 0x89 ))
upd: as i can see, DCT did not check crc, only alive counter.