This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: avoid compiler warning in regex matcher


> -----Original Message-----
> From: newlib-owner@sourceware.org [mailto:newlib-owner@sourceware.org]
> On Behalf Of Corinna Vinschen
> Sent: Tuesday, February 28, 2012 2:21 PM
> To: newlib@sourceware.org
> Subject: Re: avoid compiler warning in regex matcher
> 
> On Feb 28 06:05, Eric Blake wrote:
> > On 02/28/2012 05:12 AM, Schwarz, Konrad wrote:
> > >> @@ -198,7 +198,7 @@ int eflags;
> > >>
> > >>  				/* Jump to next possible match */
> > >>  				mj = matchjump[pp - mustfirst];
> > >> -				cj = charjump[*dp];
> > >> +				cj = charjump[(unsigned char)*dp];
> > >>  				dp += (cj < mj ? mj : cj);
> > >>  				pp = mustlast;
> > >>  			}
> > >
> > > Wouldn't it be less source and object code to define dp as an
> > > unsigned char *?
> >
> > Perhaps; I'll work up that counter-proposal patch, and we can see
> > which one looks better before I push anything (my fear is that
> > changing the type of dp may have ripple effects on how many lines of
> code need touching).
> 
> Yeah, that doesn't look good.  It's a lot of char * shuffeling so you
> probably have to convert all local vars to unsigned char * and then
> still have to cast in a couple of places...

If so, the locution *(char unsigned *) dp should still create less object
code than (char unsigned) *dp on platforms with both signed and
unsigned byte-load instructions and where plain char maps to char signed
(assuming the compiler does not detect and optimize this case).

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]