Re: [RFC] new timeofday core subsystem (v.A1)

From: Martin Waitz
Date: Thu Dec 09 2004 - 02:34:40 EST


hoi :)

On Wed, Dec 08, 2004 at 05:32:13PM -0800, john stultz wrote:
> Ah, actually, you missed something. The remainder you propose above is
> in units of cycles multiplied by mult. Thus to get it back to just
> cycles, we have to divide. So:
>
> ret *= ts->mult;
> if (rem)
> *rem = (ret & (1 << ts->shift -1))/mult;
> ret >>= ts->shift;

you are of course right

> Agreed?

well, divisions are always slow and we would loose precision again.

I have another suggestion: just keep the remainder in units of
cycles*mult.

ret *= ts->mult
if (rem) {
ret += *rem;
*rem = ret & (1 << ts->shift -1);
}
ret >>= ts->shift

and remove the offset_base adjustion below.

--
Martin Waitz

Attachment: signature.asc
Description: Digital signature