Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 9 Mar 2012 05:22:39 -0500
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: libm

On Mon, Mar 05, 2012 at 04:17:11PM +0100, Szabolcs Nagy wrote:
> * Rich Felker <dalias@...ifal.cx> [2012-03-05 09:04:59 -0500]:
> > On Mon, Mar 05, 2012 at 09:51:35AM +0100, Szabolcs Nagy wrote:
> > Hm? If you need a macro to test whether an argument is an integer or
> > floating point, try this:
> > 
> > #define __IS_FP(x) !!((1?1:(x))/2)
> > 
> 
> oh nice
> (and subtle)

I checked out your latest tgmath.h; it's surprisingly clean and
readable! A couple ideas..

1. __fun could be just fun (macro arguments are free of namespace
issues)

2. You could add something like:
#ifdef __GNUC__
#define __RETCAST(x) (__typeof__((x))
#else
#define __RETCAST(x)
#endif
Then add __RETCAST((x)), __RETCAST((x)+(y)), etc. Some trick will be
needed to make integer types result in a cast to double, though.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.