On 01/04/16 13:26, Boris Ostrovsky wrote: > On 12/30/2015 10:03 PM, Haozhong Zhang wrote: > >This patch adds several functions to take multiplication, division and > >shifting involving 64-bit integers. Those functions are derived from > >Linux kernel and will be used by later patches to calculate scaling > >ratio and scaled TSC. > > > >Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> > > Reviewed-by: Boris Ostrovsky <boris.ostrov...@oracle.com> > > (although I not sure why you decided to change Linux' code in mul64() below) > > > > >+ c = (u64)rl.l.high + rm.l.low + rn.l.low; > >+ rl.l.high = c; > >+ c >>= 32; > >+ c = c + rm.l.high + rn.l.high + rh.l.low; > >+ rh.l.low = c; > >+ rh.l.high += (u32)(c >> 32); >
I took these code from my KVM patches, but it seemed it was refactored later and also inlined with mul_u64_u64_shr(). However, above code is still equivalent to the current Linux code (if we take mul64() from mul_u64_u64_shr() in Linux), so I think it should be fine. Or do you want me to make them consistent with Linux code? Haozhong _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel