From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: * X-Spam-Status: No, score=1.8 required=3.0 tests=BAYES_50,FREEMAIL_FROM, PDS_FROM_2_EMAILS autolearn=no autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:a37:49c1:: with SMTP id w184mr10533609qka.351.1607714996970; Fri, 11 Dec 2020 11:29:56 -0800 (PST) X-Received: by 2002:a37:60f:: with SMTP id 15mr17092592qkg.211.1607714996793; Fri, 11 Dec 2020 11:29:56 -0800 (PST) Path: eternal-september.org!reader02.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 11 Dec 2020 11:29:56 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=2a02:1206:4564:fe50:44a5:93bb:4ca8:7d2d; posting-account=gRqrnQkAAAAC_02ynnhqGk1VRQlve6ZG NNTP-Posting-Host: 2a02:1206:4564:fe50:44a5:93bb:4ca8:7d2d References: <86mtykp8yd.fsf@stephe-leake.org> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: advent of code day 11 From: "gautier...@hotmail.com" Injection-Date: Fri, 11 Dec 2020 19:29:56 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:60805 List-Id: > Perform_Round( Source => Source , Result => Result , ... ); > declare Tmp: Chart_Array renames Source; > begin > Source := Result; > Result := Tmp; > end; To complete Jeff's answer, what you are doing is not a swap: it's equivalent to Source := Result; Result := Source; Ooops. The ":=" makes a complete copy of the arrays. So you'd need above "Tmp : Chart_Array := Source" to have a correct swap with 3 copies. Of course it feels a bit heavy to make all those copies. And you understandably want to avoid playing with pointers. So a solution is to define: Map : array (0 .. 1) of Chart_Array; ... current := 0; loop next := 1 - current; Perform_Round( Source => Map (current), Result => Map (next) , ... ); current := next; end loop;