⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 real.h

📁 GCC编译器源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/* Definitions of floating-point access for GNU compiler.   Copyright (C) 1989, 1991, 1994, 1996, 1997 Free Software Foundation, Inc.This file is part of GNU CC.GNU CC is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version.GNU CC is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU CC; see the file COPYING.  If not, write tothe Free Software Foundation, 59 Temple Place - Suite 330,Boston, MA 02111-1307, USA.  */#ifndef REAL_H_INCLUDED#define REAL_H_INCLUDED/* Define codes for all the float formats that we know of.  */#define UNKNOWN_FLOAT_FORMAT 0#define IEEE_FLOAT_FORMAT 1#define VAX_FLOAT_FORMAT 2#define IBM_FLOAT_FORMAT 3/* Default to IEEE float if not specified.  Nearly all machines use it.  */#ifndef TARGET_FLOAT_FORMAT#define	TARGET_FLOAT_FORMAT	IEEE_FLOAT_FORMAT#endif#ifndef HOST_FLOAT_FORMAT#define	HOST_FLOAT_FORMAT	IEEE_FLOAT_FORMAT#endif#if TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT#define REAL_INFINITY#endif/* If FLOAT_WORDS_BIG_ENDIAN and HOST_FLOAT_WORDS_BIG_ENDIAN are not defined   in the header files, then this implies the word-endianness is the same as   for integers.  *//* This is defined 0 or 1, like WORDS_BIG_ENDIAN.  */#ifndef FLOAT_WORDS_BIG_ENDIAN#define FLOAT_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN#endif/* This is defined 0 or 1, unlike HOST_WORDS_BIG_ENDIAN.  */#ifndef HOST_FLOAT_WORDS_BIG_ENDIAN#ifdef HOST_WORDS_BIG_ENDIAN#define HOST_FLOAT_WORDS_BIG_ENDIAN 1#else#define HOST_FLOAT_WORDS_BIG_ENDIAN 0#endif#endif/* Defining REAL_ARITHMETIC invokes a floating point emulator   that can produce a target machine format differing by more   than just endian-ness from the host's format.  The emulator   is also used to support extended real XFmode.  */#ifndef LONG_DOUBLE_TYPE_SIZE#define LONG_DOUBLE_TYPE_SIZE 64#endif#if (LONG_DOUBLE_TYPE_SIZE == 96) || (LONG_DOUBLE_TYPE_SIZE == 128)#ifndef REAL_ARITHMETIC#define REAL_ARITHMETIC#endif#endif#ifdef REAL_ARITHMETIC/* **** Start of software floating point emulator interface macros **** *//* Support 80-bit extended real XFmode if LONG_DOUBLE_TYPE_SIZE   has been defined to be 96 in the tm.h machine file. */#if (LONG_DOUBLE_TYPE_SIZE == 96)#define REAL_IS_NOT_DOUBLE#define REAL_ARITHMETICtypedef struct {  HOST_WIDE_INT r[(11 + sizeof (HOST_WIDE_INT))/(sizeof (HOST_WIDE_INT))];} realvaluetype;#define REAL_VALUE_TYPE realvaluetype#else /* no XFmode support */#if (LONG_DOUBLE_TYPE_SIZE == 128)#define REAL_IS_NOT_DOUBLE#define REAL_ARITHMETICtypedef struct {  HOST_WIDE_INT r[(19 + sizeof (HOST_WIDE_INT))/(sizeof (HOST_WIDE_INT))];} realvaluetype;#define REAL_VALUE_TYPE realvaluetype#else /* not TFmode */#if HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT/* If no XFmode support, then a REAL_VALUE_TYPE is 64 bits wide   but it is not necessarily a host machine double. */#define REAL_IS_NOT_DOUBLEtypedef struct {  HOST_WIDE_INT r[(7 + sizeof (HOST_WIDE_INT))/(sizeof (HOST_WIDE_INT))];} realvaluetype;#define REAL_VALUE_TYPE realvaluetype#else/* If host and target formats are compatible, then a REAL_VALUE_TYPE   is actually a host machine double. */#define REAL_VALUE_TYPE double#endif#endif /* no TFmode support */#endif /* no XFmode support */extern int significand_size	PROTO((enum machine_mode));/* If emulation has been enabled by defining REAL_ARITHMETIC or by   setting LONG_DOUBLE_TYPE_SIZE to 96 or 128, then define macros so that   they invoke emulator functions. This will succeed only if the machine   files have been updated to use these macros in place of any   references to host machine `double' or `float' types.  */#ifdef REAL_ARITHMETIC#undef REAL_ARITHMETIC#define REAL_ARITHMETIC(value, code, d1, d2) \  earith (&(value), (code), &(d1), &(d2))/* Declare functions in real.c. */extern void earith		PROTO((REAL_VALUE_TYPE *, int,				       REAL_VALUE_TYPE *, REAL_VALUE_TYPE *));extern REAL_VALUE_TYPE etrunci	PROTO((REAL_VALUE_TYPE));extern REAL_VALUE_TYPE etruncui	PROTO((REAL_VALUE_TYPE));extern REAL_VALUE_TYPE ereal_atof PROTO((char *, enum machine_mode));extern REAL_VALUE_TYPE ereal_negate PROTO((REAL_VALUE_TYPE));extern HOST_WIDE_INT efixi	PROTO((REAL_VALUE_TYPE));extern unsigned HOST_WIDE_INT efixui PROTO((REAL_VALUE_TYPE));extern void ereal_from_int	PROTO((REAL_VALUE_TYPE *,				       HOST_WIDE_INT, HOST_WIDE_INT,				       enum machine_mode));extern void ereal_from_uint	PROTO((REAL_VALUE_TYPE *,				       unsigned HOST_WIDE_INT,				       unsigned HOST_WIDE_INT,				       enum machine_mode));extern void ereal_to_int	PROTO((HOST_WIDE_INT *, HOST_WIDE_INT *,				       REAL_VALUE_TYPE));extern REAL_VALUE_TYPE ereal_ldexp PROTO((REAL_VALUE_TYPE, int));extern void etartdouble		PROTO((REAL_VALUE_TYPE, long *));extern void etarldouble		PROTO((REAL_VALUE_TYPE, long *));extern void etardouble		PROTO((REAL_VALUE_TYPE, long *));extern long etarsingle		PROTO((REAL_VALUE_TYPE));extern void ereal_to_decimal	PROTO((REAL_VALUE_TYPE, char *));extern int ereal_cmp		PROTO((REAL_VALUE_TYPE, REAL_VALUE_TYPE));extern int ereal_isneg		PROTO((REAL_VALUE_TYPE));extern REAL_VALUE_TYPE ereal_from_float PROTO((HOST_WIDE_INT));extern REAL_VALUE_TYPE ereal_from_double PROTO((HOST_WIDE_INT *));#define REAL_VALUES_EQUAL(x, y) (ereal_cmp ((x), (y)) == 0)/* true if x < y : */#define REAL_VALUES_LESS(x, y) (ereal_cmp ((x), (y)) == -1)#define REAL_VALUE_LDEXP(x, n) ereal_ldexp (x, n)/* These return REAL_VALUE_TYPE: */#define REAL_VALUE_RNDZINT(x) (etrunci (x))#define REAL_VALUE_UNSIGNED_RNDZINT(x) (etruncui (x))extern REAL_VALUE_TYPE real_value_truncate ();#define REAL_VALUE_TRUNCATE(mode, x)  real_value_truncate (mode, x)/* These return HOST_WIDE_INT: *//* Convert a floating-point value to integer, rounding toward zero.  */#define REAL_VALUE_FIX(x) (efixi (x))/* Convert a floating-point value to unsigned integer, rounding   toward zero. */#define REAL_VALUE_UNSIGNED_FIX(x) (efixui (x))#define REAL_VALUE_ATOF ereal_atof#define REAL_VALUE_NEGATE ereal_negate#define REAL_VALUE_MINUS_ZERO(x) \ ((ereal_cmp (x, dconst0) == 0) && (ereal_isneg (x) != 0 ))#define REAL_VALUE_TO_INT ereal_to_int/* Here the cast to HOST_WIDE_INT sign-extends arguments such as ~0.  */#define REAL_VALUE_FROM_INT(d, lo, hi, mode) \  ereal_from_int (&d, (HOST_WIDE_INT) (lo), (HOST_WIDE_INT) (hi), mode)#define REAL_VALUE_FROM_UNSIGNED_INT(d, lo, hi, mode) \  ereal_from_uint (&d, lo, hi, mode)/* IN is a REAL_VALUE_TYPE.  OUT is an array of longs. */#if LONG_DOUBLE_TYPE_SIZE == 96#define REAL_VALUE_TO_TARGET_LONG_DOUBLE(IN, OUT) (etarldouble ((IN), (OUT)))#else#define REAL_VALUE_TO_TARGET_LONG_DOUBLE(IN, OUT) (etartdouble ((IN), (OUT)))#endif#define REAL_VALUE_TO_TARGET_DOUBLE(IN, OUT) (etardouble ((IN), (OUT)))/* IN is a REAL_VALUE_TYPE.  OUT is a long. */#define REAL_VALUE_TO_TARGET_SINGLE(IN, OUT) ((OUT) = etarsingle ((IN)))/* d is an array of HOST_WIDE_INT that holds a double precision   value in the target computer's floating point format. */#define REAL_VALUE_FROM_TARGET_DOUBLE(d)  (ereal_from_double (d))/* f is a HOST_WIDE_INT containing a single precision target float value. */#define REAL_VALUE_FROM_TARGET_SINGLE(f)  (ereal_from_float (f))/* Conversions to decimal ASCII string.  */#define REAL_VALUE_TO_DECIMAL(r, fmt, s) (ereal_to_decimal (r, s))#endif /* REAL_ARITHMETIC defined *//* **** End of software floating point emulator interface macros **** */#else /* No XFmode or TFmode and REAL_ARITHMETIC not defined *//* old interface */#ifdef REAL_ARITHMETIC/* Defining REAL_IS_NOT_DOUBLE breaks certain initializations   when REAL_ARITHMETIC etc. are not defined.  *//* Now see if the host and target machines use the same format.    If not, define REAL_IS_NOT_DOUBLE (even if we end up representing   reals as doubles because we have no better way in this cross compiler.)   This turns off various optimizations that can happen when we know the   compiler's float format matches the target's float format.   */#if HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT#define	REAL_IS_NOT_DOUBLE#ifndef REAL_VALUE_TYPE

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -