PR ipa/83051
[official-gcc.git] / gcc / testsuite / gnat.dg / slice1.adb
blob4c24975f7a2816f9c0712f75305ee21448afc602
1 -- { dg-do compile }
2 -- { dg-options "-O2" }
4 function slice1 (Offset : Integer) return String is
6 Convert : constant String := "0123456789abcdef";
7 Buffer : String (1 .. 32);
8 Pos : Natural := Buffer'Last;
9 Value : Long_Long_Integer := Long_Long_Integer (Offset);
11 begin
12 while Value > 0 loop
13 Buffer (Pos) := Convert (Integer (Value mod 16));
14 Pos := Pos - 1;
15 Value := Value / 16;
16 end loop;
18 return Buffer (Pos + 1 .. Buffer'Last);
19 end;