Lines Matching refs:htp

62  * hrtconvert() returns the interval specified by htp as a single
63 * value in resolution htp->hrt_res. Returns -1 on overflow.
66 hrtconvert(hrtimer_t *htp)
71 product = htp->hrt_secs * htp->hrt_res;
73 if (product / htp->hrt_res == htp->hrt_secs) {
74 sum = product + htp->hrt_rem;
75 if (sum - htp->hrt_rem == product) {
90 * Convert interval expressed in htp->hrt_res to new_res.
92 * Calculate: (interval * new_res) / htp->hrt_res rounding off as
101 _hrtnewres(hrtimer_t *htp, ulong_t new_res, long round)
116 if (htp->hrt_res == 0 || new_res == 0 ||
117 new_res > NANOSEC || htp->hrt_rem < 0)
120 if (htp->hrt_rem >= htp->hrt_res) {
121 htp->hrt_secs += htp->hrt_rem / htp->hrt_res;
122 htp->hrt_rem = htp->hrt_rem % htp->hrt_res;
125 interval = htp->hrt_rem;
127 htp->hrt_res = new_res;
149 result = numerator / htp->hrt_res;
154 * (interval * new_res) % htp->hrt_res
156 * If it is greater than half of the htp->hrt_res,
161 * result * htp->hrt_res != numerator
171 modulus = numerator - result * htp->hrt_res;
179 if (twomodulus >= htp->hrt_res) {
186 htp->hrt_res = new_res;
187 htp->hrt_rem = result;
191 if (result * htp->hrt_res != numerator) {
198 htp->hrt_res = new_res;
199 htp->hrt_rem = result;
202 htp->hrt_res = new_res;
203 htp->hrt_rem = result;
223 * ((interval * new_res) + htp->hrt_res / 2) / htp->hrt_res
227 * ((interval * new_res) + htp->hrt_res - 1) / htp->hrt_res
233 drem = htp->hrt_res / 2;
236 drem = htp->hrt_res - 1;
240 dfrom_res = htp->hrt_res;
251 htp->hrt_res = new_res;
252 htp->hrt_rem = (int)quot;