Re: Problem with commit deda2e81961e96be4f2c09328baca4710a2fd1a0

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linus Torvalds
Date: Thursday, August 12, 2010 - 1:26 pm

On Thu, Aug 12, 2010 at 1:18 PM, Larry Finger <Larry.Finger@lwfinger.net> wrote:

Damn. It's your compiler turning a while-loop into a divide. Which
likely isn't even an optimization, but whatever.

John: I think that while-loop needs to be something like

   if (raw_nsecs >= NSEC_PER_SEC) {
      u64 raw_secs = raw_nsecs;
      raw_nsecs = do_div(raw_secs, NSEC_PER_SEC);
      raw_time.tv_sec += taw_secs;
  }
  raw_time.tc_nsec = raw_nsecs;

which is sad and overly complicated, but the simple thing seems to get
messed up by the compiler.

Untested. Maybe I got the complex do_div() semantics wrong. Somebody
needs to check.

                     Linus
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: Problem with commit deda2e81961e96be4f2c09328baca4710a ..., Linus Torvalds, (Thu Aug 12, 1:26 pm)
Re: Problem with commit deda2e81961e96be4f2c09328baca4710a ..., Mikael Pettersson, (Fri Aug 13, 1:45 am)