From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/1337 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: making math.h c89 compatible Date: Mon, 23 Jul 2012 00:25:21 +0200 Message-ID: <20120722222521.GH14463@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="yrj/dFKFPuw6o+aM" X-Trace: dough.gmane.org 1342995939 8363 80.91.229.3 (22 Jul 2012 22:25:39 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 22 Jul 2012 22:25:39 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-1338-gllmg-musl=m.gmane.org@lists.openwall.com Mon Jul 23 00:25:38 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1St4ak-00060o-S7 for gllmg-musl@plane.gmane.org; Mon, 23 Jul 2012 00:25:35 +0200 Original-Received: (qmail 3600 invoked by uid 550); 22 Jul 2012 22:25:33 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 3586 invoked from network); 22 Jul 2012 22:25:33 -0000 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:1337 Archived-At: --yrj/dFKFPuw6o+aM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline __FLOAT_BITS macro uses compound literal i think this is the only case where standard c header is not c89 compatible --yrj/dFKFPuw6o+aM Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="math.h.diff" diff --git a/include/math.h b/include/math.h index d732648..ffde3da 100644 --- a/include/math.h +++ b/include/math.h @@ -44,8 +44,13 @@ int __fpclassifyl(long double); union __float_repr { float __f; __uint32_t __i; }; union __double_repr { double __f; __uint64_t __i; }; +#if __STDC_VERSION__ >= 199901L #define __FLOAT_BITS(f) (((union __float_repr){ (float)(f) }).__i) #define __DOUBLE_BITS(f) (((union __double_repr){ (double)(f) }).__i) +#else +static __uint32_t __FLOAT_BITS(float __f) { union __float_repr __u = {__f}; return __u.__i; } +static __uint64_t __DOUBLE_BITS(double __f) { union __double_repr __u = {__f}; return __u.__i; } +#endif #define fpclassify(x) ( \ sizeof(x) == sizeof(float) ? __fpclassifyf(x) : \ @@ -199,8 +204,8 @@ float fmodf(float, float); long double fmodl(long double, long double); double frexp(double, int *); -float frexpf(float value, int *); -long double frexpl(long double value, int *); +float frexpf(float, int *); +long double frexpl(long double, int *); double hypot(double, double); float hypotf(float, float); --yrj/dFKFPuw6o+aM--