about summary refs log tree commit diff
path: root/bits/floatn.h
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2017-10-20 21:42:51 +0000
committerJoseph Myers <joseph@codesourcery.com>2017-10-20 21:42:51 +0000
commit797ba44ba27521261f94cc521f1c2ca74f650147 (patch)
treeabb21792a6b788673af4c3d13643731823c604a9 /bits/floatn.h
parent8f6f5362727dc93360fe37e6d4e964f386b7b8e7 (diff)
downloadglibc-797ba44ba27521261f94cc521f1c2ca74f650147.tar.gz
glibc-797ba44ba27521261f94cc521f1c2ca74f650147.tar.xz
glibc-797ba44ba27521261f94cc521f1c2ca74f650147.zip
Add bits/floatn.h defines for more _FloatN / _FloatNx types.
The bits/floatn.h header currently only has defines relating to
_Float128.  This patch adds defines relating to other _FloatN /
_FloatNx types.

The approach taken is to add defines for all _FloatN / _FloatNx types
known to GCC, and to put them in a common bits/floatn-common.h header
included at the end of all the individual bits/floatn.h headers.  If
in future some defines become different for different glibc
configurations, they will move out into the separate bits/floatn.h
headers.

Some defines are expected always to be the same across glibc ports.
Corresponding defines are nevertheless put in this header.  The intent
is that where there are conditionals (in headers or in non-installed
files) that can just repeat the same or nearly the same logic for each
floating-point type, they should do so, even if in fact the cases for
some types could be unconditionally present or absent because the same
conditionals are true or false for all glibc configurations.  This
should make the glibc code with such conditionals easier to read,
because the reader can just see that the same conditionals are
repeated for each type, rather than seeing different conditionals for
different types and needing to reason, at each location with such
differences, why those differences are indeed correct there.  (Cases
involving per-format rather than per-type logic are more likely still
to need differences in how they handle different types.)

Having such defines and conditionals also helps in incremental
preparation for adding _Float32 / _Float64 / _Float32x / _Float64x
function aliases.  I intend subsequent patches to add such
conditionals corresponding to those already present for _Float128, as
well as making more architecture-specific function implementations use
common macros to define aliases in preparation for adding such _FloatN
/ _FloatNx aliases.

Tested for x86_64.

	* bits/floatn-common.h: New file.
	* math/Makefile (headers): Add bits/floatn-common.h.
	* bits/floatn.h: Include <bits/floatn-common.h>.
	* sysdeps/ia64/bits/floatn.h: Likewise.
	* sysdeps/ieee754/ldbl-128/bits/floatn.h: Likewise.
	* sysdeps/mips/ieee754/bits/floatn.h: Likewise.
	* sysdeps/powerpc/bits/floatn.h: Likewise.
	* sysdeps/x86/bits/floatn.h: Likewise.
Diffstat (limited to 'bits/floatn.h')
-rw-r--r--bits/floatn.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/bits/floatn.h b/bits/floatn.h
index a806496b87..78eb0f47ab 100644
--- a/bits/floatn.h
+++ b/bits/floatn.h
@@ -33,3 +33,5 @@
 /* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1.
    E.g.: #define __CFLOAT128 _Complex _Float128.  */
 #undef __CFLOAT128
+
+#include <bits/floatn-common.h>