From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,FORGED_HOTMAIL_RCVD2, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,103803355c3db607 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.219.170 with SMTP id pp10mr2295456pbc.1.1340982387650; Fri, 29 Jun 2012 08:06:27 -0700 (PDT) Path: l9ni33646pbj.0!nntp.google.com!news1.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: gautier_niouzes@hotmail.com Newsgroups: comp.lang.ada Subject: Re: GNAT (GCC) Profile Guided Compilation Date: Fri, 29 Jun 2012 08:05:07 -0700 (PDT) Organization: http://groups.google.com Message-ID: <982d531a-3972-4971-b802-c7e7778b8649@googlegroups.com> References: <38b9c365-a2b2-4b8b-8d2a-1ea39d08ce86@googlegroups.com> NNTP-Posting-Host: 206.122.158.4 Mime-Version: 1.0 X-Trace: posting.google.com 1340982387 7968 127.0.0.1 (29 Jun 2012 15:06:27 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 29 Jun 2012 15:06:27 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=206.122.158.4; posting-account=gRqrnQkAAAAC_02ynnhqGk1VRQlve6ZG User-Agent: G2/1.0 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-06-29T08:05:07-07:00 List-Id: More specifically, this: --8<------8<------8<---- -- (C)2011 Keean Schupke, all rights reserved. generic type Element_Type is private; -- Element_Type is a small object; could be also eventually an index -- for an array of larger objects, or an access type to a larger object type Set_Index is range <>; package Eager_Disjointsets is type Set_Type is limited private; function Find( Set : in Set_Type; Index : in Set_Index ) return Set_Index; pragma Inline_Always(Find); procedure Makeset( Set : in out Set_Type; Index : in Set_Index ); pragma Inline_Always(Makeset); procedure Link( Set : in out Set_Type; Left, Right : in out Set_Index ); pragma Inline_Always(Link); function Get( Set : in Set_Type; Index : in Set_Index ) return Element_Type; pragma Inline_Always(Get); function Next( Set : in Set_Type; Index : in Set_Index ) return Set_Index; pragma Inline_Always(Next); procedure Set_Next( Set : in out Set_Type; Index : in Set_Index; Next : in Set_Index ); pragma Inline_Always(Set_Next); private type Node_Type is limited record Canonical : Set_Index; Successor : Set_Index; Size : Natural; Value : aliased Element_Type; end record; type Set_Type is array (Set_Index) of Node_Type; end Eager_Disjointsets; package body Eager_Disjointsets is -- Ad-hoc added by GdM for compiling the package generic type Element is private; procedure Swap(a, b: in out Element); pragma Inline(Swap); procedure Swap(a, b: in out Element) is c: Element; begin c:= a; a:= b; b:= c; end Swap; -- Ad-hoc added by GdM for compiling the package procedure Add(to: in out Natural; what: Natural) is pragma Inline(Add); begin to:= to + what; end Add; procedure Makeset( Set : in out Set_Type; Index : in Set_Index ) is begin Set(Index).Canonical := Index; Set(Index).Size := 1; end Makeset; function Find( Set : in Set_Type; Index : in Set_Index ) return Set_Index is begin return Set(Index).Canonical; end Find; procedure Swap_Indexes is new Swap(Set_Index); procedure Link( Set : in out Set_Type; Left, Right : in out Set_Index) is begin if Set(Left).Size <= Set(Right).Size then Swap_Indexes(Left, Right); end if; declare Index : Set_Index := Right; begin Link_Loop : loop Set(Index).Canonical := Left; Index := Set(Index).Successor; exit Link_Loop when Index = Right; end loop Link_Loop; end; Add(Set(Left).Size, Set(Right).Size); Swap_Indexes(Set(Left).Successor, Set(Right).Successor); end Link; function Get( Set : in Set_Type; Index : in Set_Index ) return Element_Type is begin return Set(Index).Value; end Get; function Next( Set : in Set_Type; Index : in Set_Index ) return Set_Index is begin return Set(Index).Successor; end Next; procedure Set_Next( Set : in out Set_Type; Index : in Set_Index; Next : in Set_Index ) is begin Set(Index).Successor := Next; end Set_Next; end Eager_Disjointsets;