* lib/Makefile.am, lib/alloca.c, lib/alloca.in.h, lib/argp-ba.c, lib/argp-eexst.c, lib/argp-fmtstream.c, lib/argp-fmtstream.h, lib/argp-fs-xinl.c, lib/argp-help.c, lib/argp-namefrob.h, lib/argp-parse.c, lib/argp-pin.c, lib/argp-pv.c, lib/argp-pvh.c, lib/argp-xinl.c, lib/argp.h, lib/asnprintf.c, lib/basename-lgpl.c, lib/dirname-lgpl.c, lib/dirname.h, lib/dosname.h, lib/errno.in.h, lib/float+.h, lib/float.c, lib/float.in.h, lib/getopt.c, lib/getopt.in.h, lib/getopt1.c, lib/getopt_int.h, lib/gettext.h, lib/intprops.h, lib/itold.c, lib/malloc.c, lib/memchr.c, lib/memchr.valgrind, lib/mempcpy.c, lib/printf-args.c, lib/printf-args.h, lib/printf-parse.c, lib/printf-parse.h, lib/rawmemchr.c, lib/rawmemchr.valgrind, lib/size_max.h, lib/sleep.c, lib/stdalign.in.h, lib/stdbool.in.h, lib/stddef.in.h, lib/stdint.in.h, lib/stdio.in.h, lib/stdlib.in.h, lib/strcasecmp.c, lib/strchrnul.c, lib/strchrnul.valgrind, lib/strerror-override.c, lib/strerror-override.h, lib/strerror.c, lib/string.in.h, lib/strings.in.h, lib/stripslash.c, lib/strncasecmp.c, lib/strndup.c, lib/strnlen.c, lib/sys_types.in.h, lib/sysexits.in.h, lib/unistd.in.h, lib/vasnprintf.c, lib/vasnprintf.h, lib/verify.h, lib/vsnprintf.c, lib/wchar.in.h, lib/xsize.h, m4/00gnulib.m4, m4/alloca.m4, m4/argp.m4, m4/dirname.m4, m4/double-slash-root.m4, m4/errno_h.m4, m4/exponentd.m4, m4/extensions.m4, m4/float_h.m4, m4/getopt.m4, m4/gnulib-cache.m4, m4/gnulib-common.m4, m4/gnulib-comp.m4, m4/gnulib-tool.m4, m4/include_next.m4, m4/intmax_t.m4, m4/inttypes_h.m4, m4/longlong.m4, m4/malloc.m4, m4/math_h.m4, m4/memchr.m4, m4/mempcpy.m4, m4/mmap-anon.m4, m4/multiarch.m4, m4/nocrash.m4, m4/off_t.m4, m4/printf.m4, m4/rawmemchr.m4, m4/size_max.m4, m4/sleep.m4, m4/ssize_t.m4, m4/stdalign.m4, m4/stdbool.m4, m4/stddef_h.m4, m4/stdint.m4, m4/stdint_h.m4, m4/stdio_h.m4, m4/stdlib_h.m4, m4/strcase.m4, m4/strchrnul.m4, m4/strerror.m4, m4/string_h.m4, m4/strings_h.m4, m4/strndup.m4, m4/strnlen.m4, m4/sys_socket_h.m4, m4/sys_types_h.m4, m4/sysexits.m4, m4/unistd_h.m4, m4/vasnprintf.m4, m4/vsnprintf.m4, m4/warn-on-use.m4, m4/wchar_h.m4, m4/wchar_t.m4, m4/wint_t.m4, m4/xsize.m4, tools/snippet/_Noreturn.h, tools/snippet/arg-nonnull.h, tools/snippet/c++defs.h, tools/snippet/warn-on-use.h: New files from gnulib 1af55d85d9762a679b4302d5995f05ccd883e956. * configure.ac, Makefile.am: Adjust to compile gnulib. * src/bin/Makefile.am: Adjust to use gnulib. * README: Mention lib/.
116 lines
3.9 KiB
Text
116 lines
3.9 KiB
Text
# exponentd.m4 serial 3
|
|
dnl Copyright (C) 2007-2008, 2010-2012 Free Software Foundation, Inc.
|
|
dnl This file is free software; the Free Software Foundation
|
|
dnl gives unlimited permission to copy and/or distribute it,
|
|
dnl with or without modifications, as long as this notice is preserved.
|
|
AC_DEFUN([gl_DOUBLE_EXPONENT_LOCATION],
|
|
[
|
|
AC_CACHE_CHECK([where to find the exponent in a 'double'],
|
|
[gl_cv_cc_double_expbit0],
|
|
[
|
|
AC_RUN_IFELSE(
|
|
[AC_LANG_SOURCE([[
|
|
#include <float.h>
|
|
#include <stddef.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#define NWORDS \
|
|
((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
|
|
typedef union { double value; unsigned int word[NWORDS]; } memory_double;
|
|
static unsigned int ored_words[NWORDS];
|
|
static unsigned int anded_words[NWORDS];
|
|
static void add_to_ored_words (double x)
|
|
{
|
|
memory_double m;
|
|
size_t i;
|
|
/* Clear it first, in case sizeof (double) < sizeof (memory_double). */
|
|
memset (&m, 0, sizeof (memory_double));
|
|
m.value = x;
|
|
for (i = 0; i < NWORDS; i++)
|
|
{
|
|
ored_words[i] |= m.word[i];
|
|
anded_words[i] &= m.word[i];
|
|
}
|
|
}
|
|
int main ()
|
|
{
|
|
size_t j;
|
|
FILE *fp = fopen ("conftest.out", "w");
|
|
if (fp == NULL)
|
|
return 1;
|
|
for (j = 0; j < NWORDS; j++)
|
|
anded_words[j] = ~ (unsigned int) 0;
|
|
add_to_ored_words (0.25);
|
|
add_to_ored_words (0.5);
|
|
add_to_ored_words (1.0);
|
|
add_to_ored_words (2.0);
|
|
add_to_ored_words (4.0);
|
|
/* Remove bits that are common (e.g. if representation of the first mantissa
|
|
bit is explicit). */
|
|
for (j = 0; j < NWORDS; j++)
|
|
ored_words[j] &= ~anded_words[j];
|
|
/* Now find the nonzero word. */
|
|
for (j = 0; j < NWORDS; j++)
|
|
if (ored_words[j] != 0)
|
|
break;
|
|
if (j < NWORDS)
|
|
{
|
|
size_t i;
|
|
for (i = j + 1; i < NWORDS; i++)
|
|
if (ored_words[i] != 0)
|
|
{
|
|
fprintf (fp, "unknown");
|
|
return (fclose (fp) != 0);
|
|
}
|
|
for (i = 0; ; i++)
|
|
if ((ored_words[j] >> i) & 1)
|
|
{
|
|
fprintf (fp, "word %d bit %d", (int) j, (int) i);
|
|
return (fclose (fp) != 0);
|
|
}
|
|
}
|
|
fprintf (fp, "unknown");
|
|
return (fclose (fp) != 0);
|
|
}
|
|
]])],
|
|
[gl_cv_cc_double_expbit0=`cat conftest.out`],
|
|
[gl_cv_cc_double_expbit0="unknown"],
|
|
[
|
|
dnl On ARM, there are two 'double' floating-point formats, used by
|
|
dnl different sets of instructions: The older FPA instructions assume
|
|
dnl that they are stored in big-endian word order, while the words
|
|
dnl (like integer types) are stored in little-endian byte order.
|
|
dnl The newer VFP instructions assume little-endian order
|
|
dnl consistently.
|
|
AC_EGREP_CPP([mixed_endianness], [
|
|
#if defined arm || defined __arm || defined __arm__
|
|
mixed_endianness
|
|
#endif
|
|
],
|
|
[gl_cv_cc_double_expbit0="unknown"],
|
|
[
|
|
pushdef([AC_MSG_CHECKING],[:])dnl
|
|
pushdef([AC_MSG_RESULT],[:])dnl
|
|
pushdef([AC_MSG_RESULT_UNQUOTED],[:])dnl
|
|
AC_C_BIGENDIAN(
|
|
[gl_cv_cc_double_expbit0="word 0 bit 20"],
|
|
[gl_cv_cc_double_expbit0="word 1 bit 20"],
|
|
[gl_cv_cc_double_expbit0="unknown"])
|
|
popdef([AC_MSG_RESULT_UNQUOTED])dnl
|
|
popdef([AC_MSG_RESULT])dnl
|
|
popdef([AC_MSG_CHECKING])dnl
|
|
])
|
|
])
|
|
rm -f conftest.out
|
|
])
|
|
case "$gl_cv_cc_double_expbit0" in
|
|
word*bit*)
|
|
word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'`
|
|
bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'`
|
|
AC_DEFINE_UNQUOTED([DBL_EXPBIT0_WORD], [$word],
|
|
[Define as the word index where to find the exponent of 'double'.])
|
|
AC_DEFINE_UNQUOTED([DBL_EXPBIT0_BIT], [$bit],
|
|
[Define as the bit index in the word where to find bit 0 of the exponent of 'double'.])
|
|
;;
|
|
esac
|
|
])
|