math.h macro simplification
Jeff Johnston
jjohnstn@redhat.com
Tue Jun 16 17:55:00 GMT 2009
Howland Craig D (Craig) wrote:
> The attached patch does some minor cleanup to some of the C99 number
> classification macros in math.h.
>
> fpclassify, isinf, isnan, and signbit all get rid of un-necessary use of
> GCC extensions so that they should work with all compilers. (The sizeof
> operator does not evaluate its "argument", so the extension is not
> needed to prevent multiple evaluation of the macro's argument.
> Unfortunately, the same simplifications cannot be applied to the
> 2-argument is... comparison macros, as a means is needed to ensure that
> each argument is evaluated exactly once.)
>
> isfinite is still stuck with the extension, but is sped up a little by
> saving the fpclassify return value and comparing it once or twice,
> rather than calling fpclassify, itself, once or twice. (Changing the
> values of the FP_ defines to allow a single compare--and thereby also
> allowing the extension requirement to be eliminated--was considered but
> not done to maintain full backwards compatibility.)
>
> Changes were fully tested, compared both against absolute expected
> results and the GLIBC versions as provided under RHEL5.
>
> Craig
>
Patch applied. Thanks.
-- Jeff J.
More information about the Newlib
mailing list