Commit a4492d5b authored by Alessandro Rubini's avatar Alessandro Rubini

wr-servo: avoid a libgcc 64-bit division

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent a3340842
......@@ -49,14 +49,14 @@ static int64_t ts_to_picos(TimeInternal ts)
static TimeInternal picos_to_ts(int64_t picos)
{
int64_t nsec, phase;
uint64_t nsec, phase;
TimeInternal ts;
phase = picos % 1000;
nsec = picos / 1000;
nsec = picos;
phase = __div64_32(&nsec, 1000);
ts.seconds = nsec / PP_NSEC_PER_SEC;
ts.nanoseconds = nsec % PP_NSEC_PER_SEC;
ts.nanoseconds = __div64_32(&nsec, PP_NSEC_PER_SEC);
ts.seconds = nsec; /* after the division */
ts.phase = phase;
return ts;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment