On Mon, 19 Mar 2001, Joaqu�n Cuenca Abela wrote:

> Mike Nordell wrote:
> > 
> > Joaqu�n Cuenca Abela wrote:
> > > What are your feelings about changing current growing algorithm of
> > > UT_StringBuf from a:
> > >
> > > n + 4
> > >
> > > to
> > >
> > > max(old * 1.5, n)
> > > (ie, switch to a exponential growing algorithm).
> > 
> > Has tests shown that we do that much appending? If so, I'm all for it
> > (conceptually), but not implementation-wise.
> > 1. The "n" in g_nGrowFactor says "I'm an integral type" why you can't stuff
> > 1.5 into it.
> 
> ops, good catch
> 
> > 2. Floating point operations should in this case (IMHO) be avoided (simple
> > to fix, but since you provided an alternative implementation :-) ).

Then the following could be used to multiply 'x' by 1.5:
        (x + x<<1) >> 1

I will be very fast.

 Best regards,
  -Vlad


Reply via email to