Commit c3c9d67a authored by Alessandro Rubini's avatar Alessandro Rubini

pps_gen: avoid a seemingly-64bit division

The compiler is smart enough to turn this into a multiplication by 8:

    cf54:       3d c1 00 03     sli r1,r14,3
    cf58:       59 a1 00 00     sw (r13+0),r1

and any real division by ll would be trapped by ./check-error.c .

Still, I'd better simplify the code.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 0378cd6e
......@@ -110,9 +110,7 @@ void shw_pps_gen_get_time(uint64_t * seconds, uint32_t * nanoseconds)
if (seconds)
*seconds = sec2;
if (nanoseconds)
*nanoseconds =
(uint32_t) ((int64_t) ns_cnt *
(int64_t) REF_CLOCK_PERIOD_PS / 1000LL);
*nanoseconds = ns_cnt * NS_PER_CLOCK;
}
/* Returns 1 when the adjustment operation is not yet finished */
......
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