-
- /* too fast (more than 100 tr/s) */
- if (icr_cpt < CPT_ICR_MIN)
- return 100000L;
-
- /* try to get the real time knowning icr_cpt and icr_diff */
- for (i=-1; i<2; i++) {
- diff = ((icr_cpt+i)&3) * 16384L;
- diff += (icr_diff & 0x3fff);
- diff -= icr_diff;
- if (diff > 32768L)
- diff -= 65536L;
- if (diff < -32768)
- diff += 65536L;
-
- if (AbS(diff) < AbS(best_diff)) {
- best_diff = diff;
- best_cpt = icr_cpt + i;
- }