https://gcc.gnu.org/g:73763e312fb3fc483ab0d159d35998b5d927a333
commit r16-1245-g73763e312fb3fc483ab0d159d35998b5d927a333 Author: Piotr Trojanek <troja...@adacore.com> Date: Thu Feb 27 11:44:54 2025 +0100 ada: Avoid repeated range checks when negating a rational number Use local constant to avoid repeated range checks (at least in the debug builds), but also to make the code easier to read and consistent in style with similar routines in the same package. gcc/ada/ChangeLog: * urealp.adb (UR_Negate): Capture array element in a local constant. Diff: --- gcc/ada/urealp.adb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gcc/ada/urealp.adb b/gcc/ada/urealp.adb index 3a9fddea60b5..d5fb4f55be7d 100644 --- a/gcc/ada/urealp.adb +++ b/gcc/ada/urealp.adb @@ -1237,12 +1237,13 @@ package body Urealp is --------------- function UR_Negate (Real : Ureal) return Ureal is + Val : constant Ureal_Entry := Ureals.Table (Real); begin return Store_Ureal - ((Num => Ureals.Table (Real).Num, - Den => Ureals.Table (Real).Den, - Rbase => Ureals.Table (Real).Rbase, - Negative => not Ureals.Table (Real).Negative)); + ((Num => Val.Num, + Den => Val.Den, + Rbase => Val.Rbase, + Negative => not Val.Negative)); end UR_Negate; ------------