groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] src/: ceil_prime(): Add function to get the lowest prime


From: James K. Lowden
Subject: Re: [PATCH v2] src/: ceil_prime(): Add function to get the lowest prime not smaller than n
Date: Tue, 12 Mar 2024 20:44:03 -0400

On Wed, 13 Mar 2024 13:00:57 -0500
"G. Branden Robinson" <g.branden.robinson@gmail.com> wrote:

> > If the user is creating, let us say, unnecessary or
> > counterproductive overhead by calling for a map of size 1, is that
> > ever a problem in practice?  
> 
> It was easier to "ban" it as silly (an invalid option argument value)
> than spend time verifying that this hand-rolled code assuming the
> primality of the hash table size would hold up in this pathological
> case.

I see.  IIUC, you have a bespoke hash algorithm, and the user supplies
some prime for it, and 1 isn't clearly viable.  

(Perhaps just accept 1, and use 2 instead, and no one's the wiser?  You
didn't hear it from me, of course.)

> Granted, I'm spending time on this thread instead...  ;-)

I appreciate that.  I guess I can only say that's a lousy corner to be
painted into.  As you say, it's pretty distant from groff's purpose,
and for that matter the user's purpose.  It would be best not ask.  

I'm sure ripping all that out to replace it with std::map (or whatever)
would be tedious.  But, 40 years on, an improvement, too.  

--jkl





reply via email to

[Prev in Thread] Current Thread [Next in Thread]