apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Jagielski <...@jaguNET.com>
Subject Re: cvs commit: apr/strings apr_strings.c
Date Tue, 20 Aug 2002 23:35:37 GMT
=?UTF-8?B?QnJhbmtvIMSMaWJlag==?= wrote:
> 
> Aaron Bannert wrote:
> 
> >>  +        if ( (any < 0) || (neg && (val > acc || (val -= c) >
acc))
> >>    
> >>
> >
> >Isn't that one of those short-circuits that causes bad side-effects
> >under different circumstances? I have a feeling that it is not
> >well defined if the -= operation is always performed or not, but
> >I could be wrong.
> >
> It seems well defined to me, but it's a total pain in the nethers to 
> read and understand.
> 
> > Assuming I can understand what's going on here,
> >I'll take a shot at trying to make the logic more clear (while
> >keeping as much of the constant-folding/short-circuiting as possible.)
> >  
> >
> Go go go!
> 

Actually, once any is negative, we don't need to bother with
any other checks (since we've already noted an overflow). All
the above checks do is make sure that we haven't overflowed/under-
flowed. But if we already have, then those checks are
meaningless and useless and don't need to be done (including
the arithmetics) since we don't use 'acc' at all in that case.

More a formatting issue than anything. :)

-- 
===========================================================================
   Jim Jagielski   [|]   jim@jaguNET.com   [|]   http://www.jaguNET.com/
      "A society that will trade a little liberty for a little order
             will lose both and deserve neither" - T.Jefferson

Mime
View raw message