home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / CodeWarrior Lite / Metrowerks C⁄C++ Lite / Headers / Universal Headers 2.0.1f / FixMath.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-22  |  2.9 KB  |  114 lines  |  [TEXT/MMCC]

  1. /*
  2.      File:        FixMath.h
  3.  
  4.      Contains:    Fixed Math Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.0 in “MPW Latest” on ETO #17
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __FIXMATH__
  21. #define __FIXMATH__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32.  
  33. #if PRAGMA_ALIGN_SUPPORTED
  34. #pragma options align=mac68k
  35. #endif
  36.  
  37. #if PRAGMA_IMPORT_SUPPORTED
  38. #pragma import on
  39. #endif
  40.  
  41.  
  42. enum {
  43.     fixed1                        = 0x00010000L,
  44.     fract1                        = 0x40000000L,
  45.     positiveInfinity            = 0x7FFFFFFFL,
  46.     negativeInfinity            = 0x80000000L
  47. };
  48.  
  49. extern pascal Fract Fix2Frac(Fixed x)
  50.  ONEWORDINLINE(0xA841);
  51. extern pascal long Fix2Long(Fixed x)
  52.  ONEWORDINLINE(0xA840);
  53. extern pascal Fixed Long2Fix(long x)
  54.  ONEWORDINLINE(0xA83F);
  55. extern pascal Fixed Frac2Fix(Fract x)
  56.  ONEWORDINLINE(0xA842);
  57. extern pascal Fract FracMul(Fract x, Fract y)
  58.  ONEWORDINLINE(0xA84A);
  59. extern pascal Fixed FixDiv(Fixed x, Fixed y)
  60.  ONEWORDINLINE(0xA84D);
  61. extern pascal Fract FracDiv(Fract x, Fract y)
  62.  ONEWORDINLINE(0xA84B);
  63. extern pascal Fract FracSqrt(Fract x)
  64.  ONEWORDINLINE(0xA849);
  65. extern pascal Fract FracSin(Fixed x)
  66.  ONEWORDINLINE(0xA848);
  67. extern pascal Fract FracCos(Fixed x)
  68.  ONEWORDINLINE(0xA847);
  69. extern pascal Fixed FixATan2(long x, long y)
  70.  ONEWORDINLINE(0xA818);
  71. #if GENERATINGPOWERPC
  72. extern WidePtr WideAdd(wide *target, const wide *source);
  73. extern short WideCompare(const wide *target, const wide *source);
  74. extern WidePtr WideNegate(wide *target);
  75. extern WidePtr WideShift(wide *target, long shift);
  76. extern unsigned long WideSquareRoot(const wide *source);
  77. extern WidePtr WideSubtract(wide *target, const wide *source);
  78. extern WidePtr WideMultiply(long multiplicand, long multiplier, wide *target);
  79. /* returns the quotient */
  80. extern long WideDivide(const wide *dividend, long divisor, long *remainder);
  81. /* quotient replaces dividend */
  82. extern WidePtr WideWideDivide(wide *dividend, long divisor, long *remainder);
  83. extern WidePtr WideBitShift(wide *src, long shift);
  84. #endif
  85. #if GENERATING68K && !GENERATING68881
  86. extern pascal double_t Frac2X(Fract x)
  87.  ONEWORDINLINE(0xA845);
  88. extern pascal double_t Fix2X(Fixed x)
  89.  ONEWORDINLINE(0xA843);
  90. extern pascal Fixed X2Fix(double_t x)
  91.  ONEWORDINLINE(0xA844);
  92. extern pascal Fract X2Frac(double_t x)
  93.  ONEWORDINLINE(0xA846);
  94. #else
  95. extern pascal double_t Frac2X(Fract x);
  96. extern pascal double_t Fix2X(Fixed x);
  97. extern pascal Fixed X2Fix(double_t x);
  98. extern pascal Fract X2Frac(double_t x);
  99. #endif
  100.  
  101. #if PRAGMA_IMPORT_SUPPORTED
  102. #pragma import off
  103. #endif
  104.  
  105. #if PRAGMA_ALIGN_SUPPORTED
  106. #pragma options align=reset
  107. #endif
  108.  
  109. #ifdef __cplusplus
  110. }
  111. #endif
  112.  
  113. #endif /* __FIXMATH__ */
  114.