kernel: more (arm) compiler friendly mul64fract()
the arm compiler can lift long->vlong casts on multiplcation and convert 64x64->64 multiplication into a 32x32->64 one with optional 64 bit accumulate.
This commit is contained in:
parent
5bf09937da
commit
a99cf56c7d
1 changed files with 7 additions and 11 deletions
|
@ -21,19 +21,15 @@
|
|||
void
|
||||
mul64fract(uvlong *r, uvlong a, uvlong b)
|
||||
{
|
||||
uvlong bh, bl;
|
||||
uvlong ah, al;
|
||||
uvlong res;
|
||||
ulong bh, bl, ah, al;
|
||||
|
||||
bl = b & 0xffffffffULL;
|
||||
bl = b;
|
||||
bh = b >> 32;
|
||||
al = a & 0xffffffffULL;
|
||||
al = a;
|
||||
ah = a >> 32;
|
||||
|
||||
res = (al*bl)>>32;
|
||||
res += (al*bh);
|
||||
res += (ah*bl);
|
||||
res += (ah*bh)<<32;
|
||||
|
||||
*r = res;
|
||||
*r = (((uvlong)al*(uvlong)bl)>>32)
|
||||
+ ((uvlong)al*(uvlong)bh)
|
||||
+ ((uvlong)ah*(uvlong)bl)
|
||||
+ (((uvlong)ah*(uvlong)bh)<<32);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue