[Ada] Refactor repeated implicit conversion from Char_Code to Uint
authorPiotr Trojanek <trojanek@adacore.com>
Tue, 7 Dec 2021 19:12:49 +0000 (20:12 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 6 Jan 2022 17:11:37 +0000 (17:11 +0000)
gcc/ada/

* sem_res.adb (Resolve_String_Literal): Avoid unnecessary
conversions inside "<" and ">" bodies.

gcc/ada/sem_res.adb

index ee843d3..d8784f1 100644 (file)
@@ -11722,14 +11722,14 @@ package body Sem_Res is
                Comp_Typ_Hi : constant Node_Id :=
                                Type_High_Bound (Component_Type (Typ));
 
-               Char_Val : Int;
+               Char_Val : Uint;
 
             begin
                if Compile_Time_Known_Value (Comp_Typ_Lo)
                  and then Compile_Time_Known_Value (Comp_Typ_Hi)
                then
                   for J in 1 .. Strlen loop
-                     Char_Val := Int (Get_String_Char (Str, J));
+                     Char_Val := UI_From_CC (Get_String_Char (Str, J));
 
                      if Char_Val < Expr_Value (Comp_Typ_Lo)
                        or else Char_Val > Expr_Value (Comp_Typ_Hi)