From c9207b167a3f83205e33b50af7fdfdde4d0b4658 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 26 Jan 2019 14:17:49 -0800 Subject: configure: problems with 128 bit integer detection. * configure: we can't assume that we can just edit "int" to "uint" in forming the superulong_t type. Let's consolidate the detection of the signed and unsigned superlong. Only if both are available, then emit material into config.h, along with a single constant: HAVE_SUPERLONG_T. * mpi/mpi-types.h: Don't refer to removed HAVE_USUPERLONG_T. Change superulong_t to usuperlong_t. --- configure | 21 +++++++++++---------- mpi/mpi-types.h | 4 ++-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/configure b/configure index 02c3f55c..d9bf1e80 100755 --- a/configure +++ b/configure @@ -1100,19 +1100,16 @@ fi if [ -n "$superlong" ] ; then printf '"%s"\n' "$superlong" - printf "#define HAVE_SUPERLONG_T 1\n" >> config.h - printf "typedef $superlong superlong_t;\n" >> config.h - printf "typedef $(echo $superlong | sed -e s/int/uint/) superulong_t;\n" >> config.h else printf "none\n" fi printf "Checking what C type we have for u. integers wider than \"long long\" ... " -usuperlong= +superulong= if [ -z "$broken128" ] ; then - for try_type in uint128 uint128_t __uint128 __uint128_t ; do + for try_type in uint128 uint128_t __uint128 __uint128_t 'unsigned int128'; do cat > conftest.c <> config.h - printf "typedef $usuperlong usuperlong_t;\n" >> config.h +if [ -n "$superulong" ] ; then + printf '"%s"\n' "$superulong" else printf "none\n" fi +if [ -n "$superlong" -a -n "$superulong" ] ; then + printf "#define HAVE_SUPERLONG_T 1\n" >> config.h + printf "typedef $superlong superlong_t;\n" >> config.h + printf "typedef $superulong superulong_t;\n" >> config.h +fi + printf "Checking what C integer type can hold a pointer ... " read_syms() diff --git a/mpi/mpi-types.h b/mpi/mpi-types.h index a55174fb..098efe15 100644 --- a/mpi/mpi-types.h +++ b/mpi/mpi-types.h @@ -11,11 +11,11 @@ typedef unsigned mp_size; */ typedef int mp_err; -#if HAVE_USUPERLONG_T && HAVE_ULONGLONG_T && \ +#if HAVE_SUPERLONG_T && HAVE_ULONGLONG_T && \ SIZEOF_SUPERLONG_T / 2 == SIZEOF_LONGLONG_T && \ SIZEOF_PTR >= SIZEOF_LONGLONG_T typedef ulonglong_t mp_digit; - typedef usuperlong_t mp_word; + typedef superulong_t mp_word; #define MP_DIGIT_SIZE SIZEOF_LONGLONG_T #define DIGIT_FMT "%" #SIZEOF_SUPERLONG_T "llx" #elif HAVE_ULONGLONG_T && SIZEOF_LONGLONG_T / 2 == SIZEOF_LONG && \ -- cgit v1.2.3