uintp.ads, uintp.adb (UI_Div_Rem): New subprogram, extending previous implementation...
authorThomas Quinot <quinot@adacore.com>
Fri, 6 Apr 2007 09:28:33 +0000 (11:28 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Fri, 6 Apr 2007 09:28:33 +0000 (11:28 +0200)
commit2e45500e5a5ea6308945ba9458ecccdf28d24269
tree9f79fd08002a2888dd7edf0387a56e70b06d129d
parentd72eef2995c548bcec77bebacf09e1a8a22151c4
uintp.ads, uintp.adb (UI_Div_Rem): New subprogram, extending previous implementation of UI_Div.

2007-04-06  Thomas Quinot  <quinot@adacore.com>

* uintp.ads, uintp.adb (UI_Div_Rem): New subprogram, extending previous
implementation of UI_Div.
(UI_Div): Reimplement as a call to UI_Div_Rem.
(UI_Rem): Take advantage of the fact that UI_Div_Rem provides the
remainder, avoiding the cost of a multiplication and a subtraction.
(UI_Modular_Inverse): Take advantage of the fact that UI_Div_Rem
provides both quotient and remainder in a single computation.
(UI_Modular_Exponentiation, UI_Modular_Inverse): New modular arithmetic
functions for uint.
(UI_Modular_Inverse): Add a note that the behaviour of this subprogram
is undefined if the given n is not inversible.

From-SVN: r123603
gcc/ada/uintp.adb
gcc/ada/uintp.ads