On 20.06.2018 21:33, Richard Henderson wrote:
> On 06/20/2018 12:08 AM, David Hildenbrand wrote:
>> +/* Converts ns to s390's clock format */
>> +static inline uint64_t time2tod(uint64_t ns)
>> +{
>> +    return (ns << 9) / 125;
>> +}
>> +
>> +/* Converts s390's clock format to ns */
>> +static inline uint64_t tod2time(uint64_t t)
>> +{
>> +    return (t * 125) >> 9;
>> +}
> 

In this patch I'm only moving the code. If we find this is a problem,
this should go into a separate patch.

> How many significant bits on input here?

Basically all are significant, and as it is a clock, we will reach these
bits at one point.

> Do you in fact want to be using muldiv64?

Looking at linux:

arch/s390/include/asm/timex.h

They have a lengthy documentation, resulting in (a spli to avoid overflows)

return ((todval >> 9) * 125) + (((todval & 0x1ff) * 125) >> 9);

Maybe we should do the same?

> 
> 
> r~
> 


-- 

Thanks,

David / dhildenb

Reply via email to