begin
-- We need to accommodate unsigned values
- if Siz < 8 then
- Int_Typ := Standard_Integer_8;
+ if Siz < RM_Size (Standard_Short_Short_Integer) then
+ Int_Typ := Standard_Short_Short_Integer;
- elsif Siz < 16 then
- Int_Typ := Standard_Integer_16;
+ elsif Siz < RM_Size (Standard_Short_Integer) then
+ Int_Typ := Standard_Short_Integer;
- elsif Siz < 32 then
- Int_Typ := Standard_Integer_32;
+ elsif Siz < RM_Size (Standard_Integer) then
+ Int_Typ := Standard_Integer;
else
- Int_Typ := Standard_Integer_64;
+ Int_Typ := Standard_Long_Long_Integer;
end if;
return Int_Typ;
Resolve (Operand, Opnd_Type);
+ -- If the expression is a conversion to universal integer of an
+ -- an expression with an integer type, then we can eliminate the
+ -- intermediate conversion to universal integer.
+
+ if Nkind (Operand) = N_Type_Conversion
+ and then Entity (Subtype_Mark (Operand)) = Universal_Integer
+ and then Is_Integer_Type (Etype (Expression (Operand)))
+ then
+ Rewrite (Operand, Relocate_Node (Expression (Operand)));
+ Analyze_And_Resolve (Operand);
+ end if;
+
-- In an inlined context, the unchecked conversion may be applied
-- to a literal, in which case its type is the type of the context.
-- (In other contexts conversions cannot apply to literals).