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.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Quick inverse square root Date: Mon, 4 Jan 2021 12:04:52 +0100 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <7fe2291a-bc12-4708-85aa-0ffbdc25b2bfn@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 4 Jan 2021 11:04:54 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="7cdc3bd44ff416a4cea5959139455d8d"; logging-data="17118"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+1anlX4Yn1YF0Pe4kTkw0ZqGRdXOeXjSo=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 Cancel-Lock: sha1:s7En95yXg7DKIpOe2dPmIEBE6pk= In-Reply-To: Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:61024 List-Id: On 1/4/21 4:50 AM, Matt Borchers wrote: > On Sunday, January 3, 2021 at 6:47:15 PM UTC-5, Jeffrey R. Carter wrote: >> >> if F'Size = 32 then >> return QISR32 (A); >> elsif F'Size = 64 then >> return QISR64 (A); >> else >> raise Program_Error with "F'Size must be 32 or 64"; >> end if; > > This requires duplication of algorithm which is what the generic is supposed to avoid. This would be like a psuedo-generic. Well, no. Your original generic function would be inside the generic function, and QISR32 and QISR64 would be instantiations of it with Unsigned_32 and Unsigned_64 respectively. -- Jeff Carter "Why, the Mayflower was full of Fireflies, and a few horseflies, too. The Fireflies were on the upper deck, and the horseflies were on the Fireflies." Duck Soup 95