2024-01-02 01:47:10 +00:00
|
|
|
/* Copyright (C) 1992-2024 Free Software Foundation, Inc.
|
2018-08-02 01:53:31 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
Update from Gnulib
Make the following changes by hand, and run 'admin/merge-gnulib'.
* .gitignore: Add lib/malloc/*.gl.h.
* admin/merge-gnulib: Copy lib/af_alg.h and lib/save-cwd.h
directly from Gnulib, without worrying about Gnulib modules,
as these files are special cases.
(AVOIDED_MODULES): Remove malloc-posix.
* lib/malloc.c, lib/realloc.c, m4/malloc.m4, m4/realloc.m4:
* m4/year2038.m4: New files, copied from Gnulib.
* lib/malloca.c, lib/malloca.h:
* m4/close-stream.m4, m4/glibc21.m4, m4/malloca.m4:
Remove. These are either no longer present in Gnulib, or are no
longer needed by modules that Emacs uses.
* oldXMenu/AddPane.c, oldXmenu/Addsel.c: Include XmenuInt.h first;
needed for new Gnulib.
* src/xmenu.c: Call emacs_abort, not abort.
2021-10-04 19:11:39 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
2018-08-02 01:53:31 +00:00
|
|
|
License as published by the Free Software Foundation; either
|
Update from Gnulib
Make the following changes by hand, and run 'admin/merge-gnulib'.
* .gitignore: Add lib/malloc/*.gl.h.
* admin/merge-gnulib: Copy lib/af_alg.h and lib/save-cwd.h
directly from Gnulib, without worrying about Gnulib modules,
as these files are special cases.
(AVOIDED_MODULES): Remove malloc-posix.
* lib/malloc.c, lib/realloc.c, m4/malloc.m4, m4/realloc.m4:
* m4/year2038.m4: New files, copied from Gnulib.
* lib/malloca.c, lib/malloca.h:
* m4/close-stream.m4, m4/glibc21.m4, m4/malloca.m4:
Remove. These are either no longer present in Gnulib, or are no
longer needed by modules that Emacs uses.
* oldXMenu/AddPane.c, oldXmenu/Addsel.c: Include XmenuInt.h first;
needed for new Gnulib.
* src/xmenu.c: Call emacs_abort, not abort.
2021-10-04 19:11:39 +00:00
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
2018-08-02 01:53:31 +00:00
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
Update from Gnulib
Make the following changes by hand, and run 'admin/merge-gnulib'.
* .gitignore: Add lib/malloc/*.gl.h.
* admin/merge-gnulib: Copy lib/af_alg.h and lib/save-cwd.h
directly from Gnulib, without worrying about Gnulib modules,
as these files are special cases.
(AVOIDED_MODULES): Remove malloc-posix.
* lib/malloc.c, lib/realloc.c, m4/malloc.m4, m4/realloc.m4:
* m4/year2038.m4: New files, copied from Gnulib.
* lib/malloca.c, lib/malloca.h:
* m4/close-stream.m4, m4/glibc21.m4, m4/malloca.m4:
Remove. These are either no longer present in Gnulib, or are no
longer needed by modules that Emacs uses.
* oldXMenu/AddPane.c, oldXmenu/Addsel.c: Include XmenuInt.h first;
needed for new Gnulib.
* src/xmenu.c: Call emacs_abort, not abort.
2021-10-04 19:11:39 +00:00
|
|
|
Lesser General Public License for more details.
|
2018-08-02 01:53:31 +00:00
|
|
|
|
Update from Gnulib
Make the following changes by hand, and run 'admin/merge-gnulib'.
* .gitignore: Add lib/malloc/*.gl.h.
* admin/merge-gnulib: Copy lib/af_alg.h and lib/save-cwd.h
directly from Gnulib, without worrying about Gnulib modules,
as these files are special cases.
(AVOIDED_MODULES): Remove malloc-posix.
* lib/malloc.c, lib/realloc.c, m4/malloc.m4, m4/realloc.m4:
* m4/year2038.m4: New files, copied from Gnulib.
* lib/malloca.c, lib/malloca.h:
* m4/close-stream.m4, m4/glibc21.m4, m4/malloca.m4:
Remove. These are either no longer present in Gnulib, or are no
longer needed by modules that Emacs uses.
* oldXMenu/AddPane.c, oldXmenu/Addsel.c: Include XmenuInt.h first;
needed for new Gnulib.
* src/xmenu.c: Call emacs_abort, not abort.
2021-10-04 19:11:39 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2018-08-02 01:53:31 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
Update from Gnulib
This incorporates:
2019-09-22 Update some URLs
2019-09-15 fcntl-h: fix compilation error of creat.c on MSVC
2019-09-15 creat: new module
2019-09-15 access: new module
2019-09-09 Add option to assume best, not worst, when cross-compiling.
* build-aux/config.guess, build-aux/config.sub, doc/misc/texinfo.tex:
* lib/careadlinkat.c, lib/careadlinkat.h, lib/count-leading-zeros.h:
* lib/count-trailing-zeros.h, lib/diffseq.h, lib/fcntl.in.h:
* lib/ftoastr.c, lib/get-permissions.c:
* lib/ieee754.in.h, lib/inttypes.in.h, lib/mktime.c, lib/open.c:
* lib/pathmax.h, lib/pipe2.c, lib/stddef.in.h, lib/stdint.in.h:
* lib/stdlib.in.h, lib/str-two-way.h, lib/string.in.h, lib/time.in.h:
* lib/timegm.c, lib/unistd.in.h, m4/canonicalize.m4:
* m4/extern-inline.m4, m4/fcntl_h.m4, m4/fdopendir.m4:
* m4/getgroups.m4, m4/getopt.m4, m4/gettimeofday.m4:
* m4/gnulib-common.m4, m4/largefile.m4:
* m4/lstat.m4, m4/memmem.m4, m4/mktime.m4, m4/nocrash.m4, m4/open.m4:
* m4/pselect.m4, m4/putenv.m4, m4/readlink.m4, m4/regex.m4:
* m4/symlink.m4, m4/unistd_h.m4, m4/utimens.m4, m4/utimes.m4:
Copy from Gnulib.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* m4/open-slash.m4: New file, copied from Gnulib.
2019-09-23 06:50:59 +00:00
|
|
|
<https://www.gnu.org/licenses/>. */
|
2018-08-02 01:53:31 +00:00
|
|
|
|
|
|
|
#ifndef _IEEE754_H
|
|
|
|
#define _IEEE754_H 1
|
|
|
|
|
|
|
|
#ifndef _GL_GNULIB_HEADER
|
|
|
|
/* Ordinary glibc usage. */
|
|
|
|
# include <features.h>
|
2024-06-04 04:57:53 +00:00
|
|
|
# include <bits/endian.h>
|
|
|
|
# define _IEEE754_BYTE_ORDER __BYTE_ORDER
|
|
|
|
# define _IEEE754_BIG_ENDIAN __BIG_ENDIAN
|
|
|
|
# define _IEEE754_LITTLE_ENDIAN __LITTLE_ENDIAN
|
|
|
|
# define _IEEE754_FLOAT_WORD_ORDER __FLOAT_WORD_ORDER
|
2018-08-02 01:53:31 +00:00
|
|
|
#else
|
|
|
|
/* Gnulib usage. */
|
2024-06-04 04:57:53 +00:00
|
|
|
# include <endian.h>
|
|
|
|
# define _IEEE754_BYTE_ORDER BYTE_ORDER
|
|
|
|
# define _IEEE754_BIG_ENDIAN BIG_ENDIAN
|
|
|
|
# define _IEEE754_LITTLE_ENDIAN LITTLE_ENDIAN
|
|
|
|
# define _IEEE754_FLOAT_WORD_ORDER BYTE_ORDER
|
2018-08-02 01:53:31 +00:00
|
|
|
#endif
|
|
|
|
|
2024-06-04 04:57:53 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2018-08-02 01:53:31 +00:00
|
|
|
|
|
|
|
union ieee754_float
|
|
|
|
{
|
|
|
|
float f;
|
|
|
|
|
|
|
|
/* This is the IEEE 754 single-precision format. */
|
|
|
|
struct
|
|
|
|
{
|
2024-06-04 04:57:53 +00:00
|
|
|
#if _IEEE754_BYTE_ORDER == _IEEE754_BIG_ENDIAN
|
2018-08-02 01:53:31 +00:00
|
|
|
unsigned int negative:1;
|
|
|
|
unsigned int exponent:8;
|
|
|
|
unsigned int mantissa:23;
|
|
|
|
#endif /* Big endian. */
|
2024-06-04 04:57:53 +00:00
|
|
|
#if _IEEE754_BYTE_ORDER == _IEEE754_LITTLE_ENDIAN
|
2018-08-02 01:53:31 +00:00
|
|
|
unsigned int mantissa:23;
|
|
|
|
unsigned int exponent:8;
|
|
|
|
unsigned int negative:1;
|
|
|
|
#endif /* Little endian. */
|
|
|
|
} ieee;
|
|
|
|
|
2020-05-03 21:57:10 +00:00
|
|
|
/* This format makes it easier to see if a NaN is a signalling NaN. */
|
2018-08-02 01:53:31 +00:00
|
|
|
struct
|
|
|
|
{
|
2024-06-04 04:57:53 +00:00
|
|
|
#if _IEEE754_BYTE_ORDER == _IEEE754_BIG_ENDIAN
|
2018-08-02 01:53:31 +00:00
|
|
|
unsigned int negative:1;
|
|
|
|
unsigned int exponent:8;
|
|
|
|
unsigned int quiet_nan:1;
|
|
|
|
unsigned int mantissa:22;
|
|
|
|
#endif /* Big endian. */
|
2024-06-04 04:57:53 +00:00
|
|
|
#if _IEEE754_BYTE_ORDER == _IEEE754_LITTLE_ENDIAN
|
2018-08-02 01:53:31 +00:00
|
|
|
unsigned int mantissa:22;
|
|
|
|
unsigned int quiet_nan:1;
|
|
|
|
unsigned int exponent:8;
|
|
|
|
unsigned int negative:1;
|
|
|
|
#endif /* Little endian. */
|
|
|
|
} ieee_nan;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */
|
|
|
|
|
|
|
|
|
|
|
|
union ieee754_double
|
|
|
|
{
|
|
|
|
double d;
|
|
|
|
|
|
|
|
/* This is the IEEE 754 double-precision format. */
|
|
|
|
struct
|
|
|
|
{
|
2024-06-04 04:57:53 +00:00
|
|
|
#if _IEEE754_BYTE_ORDER == _IEEE754_BIG_ENDIAN
|
2018-08-02 01:53:31 +00:00
|
|
|
unsigned int negative:1;
|
|
|
|
unsigned int exponent:11;
|
|
|
|
/* Together these comprise the mantissa. */
|
|
|
|
unsigned int mantissa0:20;
|
|
|
|
unsigned int mantissa1:32;
|
|
|
|
#endif /* Big endian. */
|
2024-06-04 04:57:53 +00:00
|
|
|
#if _IEEE754_BYTE_ORDER == _IEEE754_LITTLE_ENDIAN
|
|
|
|
# if _IEEE754_FLOAT_WORD_ORDER == _IEEE754_BIG_ENDIAN
|
2018-08-02 01:53:31 +00:00
|
|
|
unsigned int mantissa0:20;
|
|
|
|
unsigned int exponent:11;
|
|
|
|
unsigned int negative:1;
|
|
|
|
unsigned int mantissa1:32;
|
|
|
|
# else
|
|
|
|
/* Together these comprise the mantissa. */
|
|
|
|
unsigned int mantissa1:32;
|
|
|
|
unsigned int mantissa0:20;
|
|
|
|
unsigned int exponent:11;
|
|
|
|
unsigned int negative:1;
|
|
|
|
# endif
|
|
|
|
#endif /* Little endian. */
|
|
|
|
} ieee;
|
|
|
|
|
2020-05-03 21:57:10 +00:00
|
|
|
/* This format makes it easier to see if a NaN is a signalling NaN. */
|
2018-08-02 01:53:31 +00:00
|
|
|
struct
|
|
|
|
{
|
2024-06-04 04:57:53 +00:00
|
|
|
#if _IEEE754_BYTE_ORDER == _IEEE754_BIG_ENDIAN
|
2018-08-02 01:53:31 +00:00
|
|
|
unsigned int negative:1;
|
|
|
|
unsigned int exponent:11;
|
|
|
|
unsigned int quiet_nan:1;
|
|
|
|
/* Together these comprise the mantissa. */
|
|
|
|
unsigned int mantissa0:19;
|
|
|
|
unsigned int mantissa1:32;
|
|
|
|
#else
|
2024-06-04 04:57:53 +00:00
|
|
|
# if _IEEE754_FLOAT_WORD_ORDER == _IEEE754_BIG_ENDIAN
|
2018-08-02 01:53:31 +00:00
|
|
|
unsigned int mantissa0:19;
|
|
|
|
unsigned int quiet_nan:1;
|
|
|
|
unsigned int exponent:11;
|
|
|
|
unsigned int negative:1;
|
|
|
|
unsigned int mantissa1:32;
|
|
|
|
# else
|
|
|
|
/* Together these comprise the mantissa. */
|
|
|
|
unsigned int mantissa1:32;
|
|
|
|
unsigned int mantissa0:19;
|
|
|
|
unsigned int quiet_nan:1;
|
|
|
|
unsigned int exponent:11;
|
|
|
|
unsigned int negative:1;
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
} ieee_nan;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */
|
|
|
|
|
|
|
|
|
|
|
|
union ieee854_long_double
|
|
|
|
{
|
|
|
|
long double d;
|
|
|
|
|
|
|
|
/* This is the IEEE 854 double-extended-precision format. */
|
|
|
|
struct
|
|
|
|
{
|
2024-06-04 04:57:53 +00:00
|
|
|
#if _IEEE754_BYTE_ORDER == _IEEE754_BIG_ENDIAN
|
2018-08-02 01:53:31 +00:00
|
|
|
unsigned int negative:1;
|
|
|
|
unsigned int exponent:15;
|
|
|
|
unsigned int empty:16;
|
|
|
|
unsigned int mantissa0:32;
|
|
|
|
unsigned int mantissa1:32;
|
|
|
|
#endif
|
2024-06-04 04:57:53 +00:00
|
|
|
#if _IEEE754_BYTE_ORDER == _IEEE754_LITTLE_ENDIAN
|
|
|
|
# if _IEEE754_FLOAT_WORD_ORDER == _IEEE754_BIG_ENDIAN
|
2018-08-02 01:53:31 +00:00
|
|
|
unsigned int exponent:15;
|
|
|
|
unsigned int negative:1;
|
|
|
|
unsigned int empty:16;
|
|
|
|
unsigned int mantissa0:32;
|
|
|
|
unsigned int mantissa1:32;
|
|
|
|
# else
|
|
|
|
unsigned int mantissa1:32;
|
|
|
|
unsigned int mantissa0:32;
|
|
|
|
unsigned int exponent:15;
|
|
|
|
unsigned int negative:1;
|
|
|
|
unsigned int empty:16;
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
} ieee;
|
|
|
|
|
|
|
|
/* This is for NaNs in the IEEE 854 double-extended-precision format. */
|
|
|
|
struct
|
|
|
|
{
|
2024-06-04 04:57:53 +00:00
|
|
|
#if _IEEE754_BYTE_ORDER == _IEEE754_BIG_ENDIAN
|
2018-08-02 01:53:31 +00:00
|
|
|
unsigned int negative:1;
|
|
|
|
unsigned int exponent:15;
|
|
|
|
unsigned int empty:16;
|
|
|
|
unsigned int one:1;
|
|
|
|
unsigned int quiet_nan:1;
|
|
|
|
unsigned int mantissa0:30;
|
|
|
|
unsigned int mantissa1:32;
|
|
|
|
#endif
|
2024-06-04 04:57:53 +00:00
|
|
|
#if _IEEE754_BYTE_ORDER == _IEEE754_LITTLE_ENDIAN
|
|
|
|
# if _IEEE754_FLOAT_WORD_ORDER == _IEEE754_BIG_ENDIAN
|
2018-08-02 01:53:31 +00:00
|
|
|
unsigned int exponent:15;
|
|
|
|
unsigned int negative:1;
|
|
|
|
unsigned int empty:16;
|
|
|
|
unsigned int mantissa0:30;
|
|
|
|
unsigned int quiet_nan:1;
|
|
|
|
unsigned int one:1;
|
|
|
|
unsigned int mantissa1:32;
|
|
|
|
# else
|
|
|
|
unsigned int mantissa1:32;
|
|
|
|
unsigned int mantissa0:30;
|
|
|
|
unsigned int quiet_nan:1;
|
|
|
|
unsigned int one:1;
|
|
|
|
unsigned int exponent:15;
|
|
|
|
unsigned int negative:1;
|
|
|
|
unsigned int empty:16;
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
} ieee_nan;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define IEEE854_LONG_DOUBLE_BIAS 0x3fff
|
|
|
|
|
2024-06-04 04:57:53 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2018-08-02 01:53:31 +00:00
|
|
|
|
|
|
|
#endif /* ieee754.h */
|