Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
5.1 KiB

  1. /*
  2. * Adobe Universal Font Library
  3. *
  4. * Copyright (c) 1996 Adobe Systems Inc.
  5. * All Rights Reserved
  6. *
  7. * UFLMath
  8. *
  9. *
  10. * $Header:
  11. */
  12. #ifndef _H_UFLMath
  13. #define _H_UFLMath
  14. /*===============================================================================*
  15. * Include files used by this interface *
  16. *===============================================================================*/
  17. #include "UFLCnfig.h"
  18. #ifndef _H_UFLTypes
  19. #include "UFLTypes.h"
  20. #endif
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Floating point arithmathics */
  25. #ifdef WIN32KERNEL
  26. typedef FLOATOBJ UFLFLOATOBJ;
  27. typedef PFLOATOBJ PUFLFLOATOBJ;
  28. #define UFLFLOATOBJ_SetFloat(pf,f) FLOATOBJ_SetFloat((pf),(f))
  29. #define UFLFLOATOBJ_SetLong(pf,l) FLOATOBJ_SetLong((pf),(l))
  30. #define UFLFLOATOBJ_GetFloat(pf) FLOATOBJ_GetFloat((pf))
  31. #define UFLFLOATOBJ_GetLong(pf) FLOATOBJ_GetLong((pf))
  32. #define UFLFLOATOBJ_AddFloat(pf,f) FLOATOBJ_AddFloat((pf),(f))
  33. #define UFLFLOATOBJ_AddLong(pf,l) FLOATOBJ_AddLong((pf),(l))
  34. #define UFLFLOATOBJ_Add(pf,pf1) FLOATOBJ_Add((pf),(pf1))
  35. #define UFLFLOATOBJ_SubFloat(pf,f) FLOATOBJ_SubFloat((pf),(f))
  36. #define UFLFLOATOBJ_SubLong(pf,l) FLOATOBJ_SubLong((pf),(l))
  37. #define UFLFLOATOBJ_Sub(pf,pf1) FLOATOBJ_Sub((pf),(pf1))
  38. #define UFLFLOATOBJ_MulFloat(pf,f) FLOATOBJ_MulFloat((pf),(f))
  39. #define UFLFLOATOBJ_MulLong(pf,l) FLOATOBJ_MulLong((pf),(l))
  40. #define UFLFLOATOBJ_Mul(pf,pf1) FLOATOBJ_Mul((pf),(pf1))
  41. #define UFLFLOATOBJ_DivFloat(pf,f) FLOATOBJ_DivFloat((pf),(f))
  42. #define UFLFLOATOBJ_DivLong(pf,l) FLOATOBJ_DivLong((pf),(l))
  43. #define UFLFLOATOBJ_Div(pf,pf1) FLOATOBJ_Div((pf),(pf1))
  44. #define UFLFLOATOBJ_Neg(pf) FLOATOBJ_Neg((pf))
  45. #define UFLFLOATOBJ_EqualLong(pf,l) FLOATOBJ_EqualLong((pf),(l))
  46. #define UFLFLOATOBJ_GreaterThanLong(pf,l) FLOATOBJ_GreaterThanLong((pf),(l))
  47. #define UFLFLOATOBJ_LessThanLong(pf,l) FLOATOBJ_LessThanLong((pf),(l))
  48. #define UFLFLOATOBJ_Equal(pf,pf1) FLOATOBJ_Equal((pf),(pf1))
  49. #define UFLFLOATOBJ_GreaterThan(pf,pf1) FLOATOBJ_GreaterThan((pf),(pf1))
  50. #define UFLFLOATOBJ_LessThan(pf,pf1) FLOATOBJ_LessThan((pf),(pf1))
  51. #else
  52. // any platform that has support for floats in the kernel
  53. typedef float UFLFLOATOBJ;
  54. typedef float *PUFLFLOATOBJ;
  55. #define UFLFLOATOBJ_SetFloat(pf,f) {*(pf) = (float)(f); }
  56. #define UFLFLOATOBJ_SetLong(pf,l) {*(pf) = (float)(l); }
  57. #define UFLFLOATOBJ_GetFloat(pf) *((unsigned long *)pf)
  58. #define UFLFLOATOBJ_GetLong(pf) (long)*(pf)
  59. #define UFLFLOATOBJ_AddFloat(pf,f) {*(pf) += (float)(f); }
  60. #define UFLFLOATOBJ_AddLong(pf,l) {*(pf) += (long)(l); }
  61. #define UFLFLOATOBJ_Add(pf,pf1) {*(pf) += *(pf1); }
  62. #define UFLFLOATOBJ_SubFloat(pf,f) {*(pf) -= (float)(f); }
  63. #define UFLFLOATOBJ_SubLong(pf,l) {*(pf) -= (long)(l); }
  64. #define UFLFLOATOBJ_Sub(pf,pf1) {*(pf) -= *(pf1); }
  65. #define UFLFLOATOBJ_MulFloat(pf,f) {*(pf) *= (float)(f); }
  66. #define UFLFLOATOBJ_MulLong(pf,l) {*(pf) *= (long)(l); }
  67. #define UFLFLOATOBJ_Mul(pf,pf1) {*(pf) *= *(pf1); }
  68. #define UFLFLOATOBJ_DivFloat(pf,f) {*(pf) /= (float)(f); }
  69. #define UFLFLOATOBJ_DivLong(pf,l) {*(pf) /= (long)(l); }
  70. #define UFLFLOATOBJ_Div(pf,pf1) {*(pf) /= *(pf1); }
  71. #define UFLFLOATOBJ_Neg(pf) {*(pf) = -*(pf); }
  72. #define UFLFLOATOBJ_EqualLong(pf,l) (*(pf) == (float)(l))
  73. #define UFLFLOATOBJ_GreaterThanLong(pf,l) (*(pf) > (float)(l))
  74. #define UFLFLOATOBJ_LessThanLong(pf,l) (*(pf) < (float)(l))
  75. #define UFLFLOATOBJ_Equal(pf,pf1) (*(pf) == *(pf1))
  76. #define UFLFLOATOBJ_GreaterThan(pf,pf1) (*(pf) > *(pf1))
  77. #define UFLFLOATOBJ_LessThan(pf,pf1) (*(pf) < *(pf1))
  78. #endif /* WIN32KERNEL */
  79. /* UFLFixed macros */
  80. #define UFLFixedMant( x ) ( ((UFLSepFixed*)&x)->mant )
  81. #define UFLFixedFraction( x ) ( ((UFLSepFixed*)&x)->frac )
  82. #define UFLTruncFixedToShort( x ) (short)( (x) >> 16 )
  83. #define UFLRoundFixedToShort( x ) (short)( ((x) + 0x08000) >> 16 )
  84. #define UFLCeilingFixedToShort( x ) (short)( ((x) + 0x0ffff) >> 16 )
  85. #define UFLShortToFixed( x ) ( ((UFLFixed)(x)) << 16 )
  86. #define UFLTruncFixed( x ) ( (x) & 0xffff0000 )
  87. #define UFLFixedOne (UFLFixed)0x00010000
  88. #define UFLRoundFixed( x ) (((x) + 0x08000) & 0xffff0000)
  89. UFLFixed UFLFltToFix(float x);
  90. UFLFixed UFLFixedDiv( UFLFixed a, UFLFixed b );
  91. UFLFixed UFLFixedMul( UFLFixed a, UFLFixed b );
  92. #ifdef __cplusplus
  93. }
  94. #endif
  95. #endif