[PATCH] simple speedup in decode_reg_name
Andrew Pinski
pinskia@physics.uc.edu
Thu Aug 19 05:54:00 GMT 2004
>
> > - if (asmspec != 0)
> > + if (asmspec != 0 && strlen (asmspec) != 0)
>
> When looking for a zero length string, wouldn't (*asmspec != '\0') be
> even faster than calling strlen?
I know we have mentioned this before, strlen (x) != 0 gets optimized
into *x != 0, likewise for strlen (x) == 0.
The reason why I spelled out strlen is because it tells the reader
what we are doing and also just in case C strings change their
definition (which will not happen but who knows). It is also
easier to change strlen (x) == 0 into something different
for another language.
Thanks,
Andrew Pinski
More information about the Gcc-patches
mailing list