-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
75 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
u32 MINUS_Q = -8380417; | ||
|
||
inline fn __montgomery_reduce_8380417( | ||
reg u32 a_low a_high | ||
) -> reg u32 | ||
{ | ||
reg u32 a_low_x7 a_low_x7169 a_low_x58728449; | ||
reg u32 minus_q; | ||
reg u32 res; | ||
|
||
a_low_x7 = (a_low << 3) - a_low; | ||
a_low_x7169 = a_low + (a_low_x7 << 10); | ||
|
||
minus_q = MINUS_Q; | ||
|
||
a_low_x58728449 = a_low + (a_low_x7169 << 13); | ||
|
||
// (a_low_x58728449 * minus_q) + (a_low + a_high * 2**32); | ||
_, res = #SMLAL(a_low, a_high, a_low_x58728449, minus_q); | ||
|
||
res = res; | ||
return res; | ||
} | ||
|
||
|
||
export fn montgomery_reduce_8380417(reg u32 al ah) -> reg u32 | ||
{ | ||
reg u32 r; | ||
|
||
r = __montgomery_reduce_8380417(al, ah); | ||
|
||
return r; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters