home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / gnu / gccsrc2 / real.h < prev    next >
C/C++ Source or Header  |  1993-07-23  |  3KB  |  95 lines

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