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: math.h macro simplification


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.


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