home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / GCC 1.37.1r14 / usr / gcc-1.37.1r14 / (gcc-1.37.π) / real.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-01  |  3.2 KB  |  104 lines  |  [TEXT/KAHL]

  1. /* Front-end tree definitions for GNU compiler.
  2.    Copyright (C) 1989 Free Software Foundation, Inc.
  3.    Copyright (C) 1989, 1990 Apple Computer, Inc.
  4.  
  5. This file is part of GNU CC.
  6.  
  7. GNU CC is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 1, or (at your option)
  10. any later version.
  11.  
  12. GNU CC is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with GNU CC; see the file COPYING.  If not, write to
  19. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. #ifndef REAL_H_INCLUDED
  22. #define REAL_H_INCLUDED
  23.  
  24. /* If we are not cross-compiling, use a `double' to represent the
  25.    floating-point value.  Otherwise, use some other type
  26.    (probably a struct containing an array of longs).  */
  27. #ifndef REAL_VALUE_TYPE
  28. #define REAL_VALUE_TYPE double
  29. #else
  30. #ifdef APPLE_HAX
  31.  /* nothing needed. */
  32. #else
  33. #define REAL_IS_NOT_DOUBLE
  34. #endif /* APPLE_HAX */
  35. #endif
  36.  
  37. /* Compare two floating-point values for equality.  */
  38. #ifndef REAL_VALUES_EQUAL
  39. #define REAL_VALUES_EQUAL(x,y) ((x) == (y))
  40. #endif
  41.  
  42. /* Compare two floating-point values for less than.  */
  43. #ifndef REAL_VALUES_LESS
  44. #define REAL_VALUES_LESS(x,y) ((x) < (y))
  45. #endif
  46.  
  47. /* Scale X by Y powers of 2.  */
  48. #ifndef REAL_VALUE_LDEXP
  49. #define REAL_VALUE_LDEXP(x,y) ldexp (x, y)
  50. extern double ldexp ();
  51. #endif
  52.  
  53. /* Convert the string X to a floating-point value.  */
  54. #ifndef REAL_VALUE_ATOF
  55. #define REAL_VALUE_ATOF(x) atof (x)
  56. extern double atof ();
  57. #endif
  58.  
  59. /* Negate the floating-point value X.  */
  60. #ifndef REAL_VALUE_NEGATE
  61. #define REAL_VALUE_NEGATE(x) (- (x))
  62. #endif
  63.  
  64. /* Truncate the floating-point value X to single-precision.  */
  65. #ifndef REAL_VALUE_TRUNCATE
  66. #define REAL_VALUE_TRUNCATE(x) ((float) (x))
  67. #endif
  68.  
  69. /* Union type used for extracting real values from CONST_DOUBLEs
  70.    or putting them in.  */
  71.  
  72. union real_extract 
  73. {
  74.   REAL_VALUE_TYPE d;
  75.   int i[sizeof (REAL_VALUE_TYPE) / sizeof (int)];
  76. };
  77.  
  78. /* For a CONST_DOUBLE:
  79.    The usual two ints that hold the value.
  80.    For a DImode, that is all there are;
  81.     and CONST_DOUBLE_LOW is the low-order word and ..._HIGH the high-order.
  82.    For a float, the number of ints varies,
  83.     and CONST_DOUBLE_LOW is the one that should come first *in memory*.
  84.     So use &CONST_DOUBLE_LOW(r) as the address of an array of ints.  */
  85. #define CONST_DOUBLE_LOW(r) XINT (r, 2)
  86. #define CONST_DOUBLE_HIGH(r) XINT (r, 3)
  87. #ifdef APPLE_C
  88. /* Define an accessor to the third word of an extended float. */
  89. #define CONST_DOUBLE_TOP(r) XINT (r, 4)
  90. #endif /* APPLE_C */
  91.  
  92. /* Link for chain of all CONST_DOUBLEs in use in current function.  */
  93. #define CONST_DOUBLE_CHAIN(r) XEXP (r, 1)
  94. /* The MEM which represents this CONST_DOUBLE's value in memory,
  95.    or const0_rtx if no MEM has been made for it yet,
  96.    or cc0_rtx if it is not on the chain.  */
  97. #define CONST_DOUBLE_MEM(r) XEXP (r, 0)
  98.  
  99. /* Function to return a real value (not a tree node)
  100.    from a given integer constant.  */
  101. REAL_VALUE_TYPE real_value_from_int_cst ();
  102.  
  103. #endif /* Not REAL_H_INCLUDED */
  104.