-
Notifications
You must be signed in to change notification settings - Fork 49
Check new bounded_int_mul implementation #1478
Copy link
Copy link
Open
Description
We have C = A * B, where all of them are BoundedInt. We represent the BoundedInt as:
- X = Xo + Xd, where
- X is a BoundedInt.
- Xo is the lower bound of the BoundedInt range.
- Xd is the offset.
So we have:
Cd = (Ad + Ao) * (Bd + Bo) - Co -> Cd = (Ad * Bd) + (Ad * Bo) + (Bd * Ao) + (Ao * Bo - Co)
We can separate it into run-time values:
AdwithPbits.BdwithQbits.Ad * BdwithX = max(P, Q) * 2bitsAd * BowithY = max(P, S) * 2bitsBd * AowithZ = max(Q, R) * 2bits
And compile-time values:AowithRbits.BowithSbits.Ao * Bo - CowithWbits.
We should check if this new implementation is more performant than what we have now. This algorithm implementation can be seen here.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels