some stuff in C to calculate PCR values