diff options
author | Szabolcs Nagy <nsz@port70.net> | 2012-12-19 04:05:30 +0100 |
---|---|---|
committer | Szabolcs Nagy <nsz@port70.net> | 2012-12-19 04:05:30 +0100 |
commit | e9e2b66e687bc0b4d07305a2b288ed8ff4ae5b4b (patch) | |
tree | c4fce41ccde790f927862ddd0092d1762ab0ff66 /src/fenv/i386 | |
parent | c6383b7b10303457306932584fc23f24b5153a81 (diff) | |
download | musl-e9e2b66e687bc0b4d07305a2b288ed8ff4ae5b4b.tar.gz |
math: new type cast logic in tgmath.h
* return type logic is simplified a bit and fixed (see below)
* return type of conj and cproj were wrong on int arguments
* added comments about the pending issues
(usually we don't have comments in public headers but this is
not the biggest issue with tgmath.h)
casting the result to the right type cannot be done in c99
(c11 _Generic can solve this but that is not widely supported),
so the typeof extension of gcc is used and that the ?: operator
has special semantics when one of the operands is a null
pointer constant
the standard is very strict about the definition of null
pointer constants so typeof with ?: is still not enough so
compiler specific workaround is used for now
on gcc '!1.0' is a null pointer constant so we can use the old
__IS_FP logic (eventhough it's non-standard)
on clang (and on gcc as well) 'sizeof(void)-1' is a null
pointer constant so we can use
!(sizeof(*(0?(int*)0:(void*)__IS_FP(x)))-1)
(this is non-standard as well), the old logic is used by
default and this new one on clang
Diffstat (limited to 'src/fenv/i386')
0 files changed, 0 insertions, 0 deletions