diff options
author | Andres Freund <andres@anarazel.de> | 2015-03-20 10:26:17 +0100 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2015-03-20 10:26:17 +0100 |
commit | 8122e1437e332e156d971a0274879b0ee76e488a (patch) | |
tree | 4049661023618ba959e645969698c7829ce19ed1 /src | |
parent | 7e9ed623d9988fcb1497a2a8ca7f676a5bfa136f (diff) | |
download | postgresql-8122e1437e332e156d971a0274879b0ee76e488a.tar.gz postgresql-8122e1437e332e156d971a0274879b0ee76e488a.zip |
Add, optional, support for 128bit integers.
We will, for the foreseeable future, not expose 128 bit datatypes to
SQL. But being able to use 128bit math will allow us, in a later patch,
to use 128bit accumulators for some aggregates; leading to noticeable
speedups over using numeric.
So far we only detect a gcc/clang extension that supports 128bit math,
but no 128bit literals, and no *printf support. We might want to expand
this in the future to further compilers; if there are any that that
provide similar support.
Discussion: 544BB5F1.50709@proxel.se
Author: Andreas Karlsson, with significant editorializing by me
Reviewed-By: Peter Geoghegan, Oskari Saarenmaa
Diffstat (limited to 'src')
-rw-r--r-- | src/include/c.h | 11 | ||||
-rw-r--r-- | src/include/pg_config.h.in | 3 | ||||
-rw-r--r-- | src/include/pg_config.h.win32 | 3 |
3 files changed, 17 insertions, 0 deletions
diff --git a/src/include/c.h b/src/include/c.h index a2d4a2c5c5d..744721860c5 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -293,6 +293,17 @@ typedef unsigned long long int uint64; #define HAVE_INT64_TIMESTAMP #endif +/* + * 128-bit signed and unsigned integers + * There currently is only a limited support for the type. E.g. 128bit + * literals and snprintf are not supported; but math is. + */ +#if defined(PG_INT128_TYPE) +#define HAVE_INT128 +typedef PG_INT128_TYPE int128; +typedef unsigned PG_INT128_TYPE uint128; +#endif + /* sig_atomic_t is required by ANSI C, but may be missing on old platforms */ #ifndef HAVE_SIG_ATOMIC_T typedef int sig_atomic_t; diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index ece57c81ccf..202c51a34a5 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -711,6 +711,9 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* Define to the name of a signed 128-bit integer type. */ +#undef PG_INT128_TYPE + /* Define to the name of a signed 64-bit integer type. */ #undef PG_INT64_TYPE diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32 index 3f858c658b9..1baf64f0056 100644 --- a/src/include/pg_config.h.win32 +++ b/src/include/pg_config.h.win32 @@ -562,6 +562,9 @@ /* Define to the version of this package. */ #define PACKAGE_VERSION "9.5devel" +/* Define to the name of a signed 128-bit integer type. */ +#undef PG_INT128_TYPE + /* Define to the name of a signed 64-bit integer type. */ #define PG_INT64_TYPE long long int |