home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 Mobile / Chip_Mobile_2001.iso / palm / hobby / palmoon / palmoon.EXE / math_private.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-07-13  |  2.8 KB  |  71 lines

  1. /* MathLib: Pilot shared library of IEEE-754 double math functions
  2.  *
  3.  * Minimum subset of GCC math_private.h file; just enough to allow proper
  4.  * compilation of the GCC source code with as few changes as possible.
  5. .* These frequently used extraction and insertion macros have been
  6.  * rewritten to generate more efficient code under CodeWarrior.
  7.  *
  8.  * Copyright (C) 1997 Rick Huebner
  9.  *
  10.  * This program is free software; you can redistribute it and/or modify
  11.  * it under the terms of the GNU Library General Public License as
  12.  * published by the Free Software Foundation; either version 2 of
  13.  * the License, or (at your option) any later version.
  14.  *
  15.  * This program is distributed in the hope that it will be useful,
  16.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.  * GNU Library General Public License for more details.
  19.  *
  20.  * You should have received a copy of the GNU Library General Public License
  21.  * along with this program; see file COPYING.LIB.  If not, write to the
  22.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  23.  * Boston, MA 02111-1307, USA
  24.  *
  25.  * Version 1.0, 15 August 1997, Rick Huebner
  26.  */
  27. // Stub out unused macros
  28. #define weak_alias(x,y)
  29. #define strong_alias(x,y)
  30.  
  31. #define __HI32(x) *((u_int32_t *) &x)
  32. #define __LO32(x) *((u_int32_t *) &x + 1)
  33.  
  34. /* Get two 32 bit ints from a double.  */
  35. #define EXTRACT_WORDS(ix0,ix1,d)                                \
  36. do {                                                            \
  37.     (ix0) = __HI32(d);                                            \
  38.     (ix1) = __LO32(d);                                            \
  39. } while (0)
  40.  
  41. /* Get the more significant 32 bit int from a double.  */
  42. #define GET_HIGH_WORD(i,d)                                      \
  43. do {                                                            \
  44.     (i) = __HI32(d);                                            \
  45. } while (0)
  46.  
  47. /* Get the less significant 32 bit int from a double.  */
  48. #define GET_LOW_WORD(i,d)                                         \
  49. do {                                                            \
  50.     (i) = __LO32(d);                                            \
  51. } while (0)
  52.  
  53. /* Set a double from two 32 bit ints.  */
  54. #define INSERT_WORDS(d,ix0,ix1)                                 \
  55. do {                                                            \
  56.     __HI32(d) = (ix0);                                            \
  57.     __LO32(d) = (ix1);                                            \
  58. } while (0)
  59.  
  60. /* Set the more significant 32 bits of a double from an int.  */
  61. #define SET_HIGH_WORD(d,v)                                        \
  62. do {                                                            \
  63.     __HI32(d) = (v);                                            \
  64. } while (0)
  65.  
  66. /* Set the less significant 32 bits of a double from an int.  */
  67. #define SET_LOW_WORD(d,v)                                        \
  68. do {                                                            \
  69.     __LO32(d) = (v);                                            \
  70. } while (0)
  71.