lkml.org 
[lkml]   [2012]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/9] time: Condense timekeeper.xtime into xtime_sec
On Thu, 1 Mar 2012, John Stultz wrote:

> +static inline void tk_normalize_xtime(struct timekeeper *tk)
> +{
> + while (tk->xtime_nsec >= ((u64)NSEC_PER_SEC << tk->shift)) {
> + tk->xtime_nsec -= (u64)NSEC_PER_SEC << tk->shift;
> + tk->xtime_sec++;
> + }
> +}

Could we avoid the loop?

y = ((u64)NSEC_PER_SEC << tk->shift));
tk->xtime_sec += tk->xtime_nsec / y;
tk->xtime_nsec %= y;



\
 
 \ /
  Last update: 2012-03-02 22:15    [W:0.125 / U:0.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site