comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Quick inverse square root
Date: Mon, 4 Jan 2021 12:04:52 +0100	[thread overview]
Message-ID: <rsusom$gmu$1@dont-email.me> (raw)
In-Reply-To: <cdd6f0e2-44eb-44cf-a2a3-6eafe3b0d469n@googlegroups.com>

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

  parent reply	other threads:[~2021-01-04 11:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-02 22:26 Quick inverse square root Matt Borchers
2021-01-02 23:18 ` Jeffrey R. Carter
2021-01-03 10:58 ` Dmitry A. Kazakov
2021-01-03 22:31   ` Matt Borchers
2021-01-03 23:47     ` Jeffrey R. Carter
2021-01-04  3:50       ` Matt Borchers
2021-01-04  4:28         ` Matt Borchers
2021-01-04 11:04         ` Jeffrey R. Carter [this message]
2021-01-04 11:13     ` AdaMagica
2021-01-04 11:28       ` AdaMagica
2021-01-04 12:13         ` Dmitry A. Kazakov
2021-01-04 13:39 ` Egil H H
2021-01-04 20:55   ` Matt Borchers
2021-01-04 21:06     ` Paul Rubin
2021-01-05  2:22       ` Matt Borchers
2021-01-07 17:49     ` Brian Drummond
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox