port fast crc code to go from c