lkml.org 
[lkml]   [2004]   [Dec]   [9]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateThu, 9 Dec 2004 08:32:33 +0100
FromMartin Waitz <>
SubjectRe: [RFC] new timeofday core subsystem (v.A1)
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
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 14:08    [from the cache]
©2003-2008