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.

147 lines
3.6 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: equad.hxx
  3. *
  4. * A class version of LARGE_INTEGER's
  5. *
  6. * Created: 26-Apr-1991 12:48:13
  7. * Author: Kirk Olynyk [kirko]
  8. *
  9. * Copyright (c) 1991-1999 Microsoft Corporation
  10. *
  11. \**************************************************************************/
  12. extern "C" {
  13. VOID
  14. vEfToLfx(
  15. EFLOAT *pefloat,
  16. LONGLONG *plfx
  17. );
  18. };
  19. #define DIV(u64,u32) \
  20. (((u64) < ULONG_MAX) ? (((ULONG) (u64)) / (u32)) : \
  21. RtlEnlargedUnsignedDivide(*(ULARGE_INTEGER*) &(u64),(u32),0))
  22. #define DIVREM(u64,u32,pul) \
  23. RtlEnlargedUnsignedDivide(*(ULARGE_INTEGER*) &(u64), (u32), (pul))
  24. #define VDIV(u64,u32,pul) \
  25. if ((LONGLONG)u64 >= 0) \
  26. { \
  27. *(LARGE_INTEGER*) &(u64) = \
  28. RtlExtendedLargeIntegerDivide( \
  29. *(LARGE_INTEGER *)&(u64), \
  30. (u32), \
  31. (pul) \
  32. ); \
  33. } \
  34. else \
  35. { \
  36. LONGLONG ll = -u64; \
  37. \
  38. *(LARGE_INTEGER*) &(ll) = \
  39. RtlExtendedLargeIntegerDivide( \
  40. *(LARGE_INTEGER *)&(ll), \
  41. (u32), \
  42. (pul) \
  43. ); \
  44. u64 = -ll; \
  45. }
  46. /*********************************Class************************************\
  47. * class EPOINTQF
  48. *
  49. * History:
  50. * 25-Sep-1991 -by- Bodin Dresevic [BodinD]
  51. * Wrote it.
  52. \**************************************************************************/
  53. class EPOINTQF // eptqf
  54. {
  55. public:
  56. LONGLONG x;
  57. LONGLONG y;
  58. // Constructor -- This one is to allow EPOINTQF inside other classes.
  59. EPOINTQF() {}
  60. ~EPOINTQF() {}
  61. // Operator= -- Create from a POINTL
  62. VOID operator=(POINTL& ptl)
  63. {
  64. x = ((LONGLONG) ptl.x) << 32;
  65. y = ((LONGLONG) ptl.y) << 32;
  66. }
  67. // Operator= -- Create from a POINTQF
  68. VOID operator=(POINTQF& ptqf)
  69. {
  70. *((PPOINTQF)this) = ptqf;
  71. }
  72. // we need one to convert to and from EPOINTFL for wendy's xform stuff
  73. // Operator= -- Create from a EPOINTFL
  74. VOID operator=(EPOINTFL& eptfl)
  75. {
  76. vEfToLfx(&eptfl.x,&this->x);
  77. vEfToLfx(&eptfl.y,&this->y);
  78. }
  79. // Operator+= -- Add in another POINTQF.
  80. VOID operator+=(POINTQF& ptqf)
  81. {
  82. x += *(LONGLONG*) &(ptqf.x);
  83. y += *(LONGLONG*) &(ptqf.y);
  84. }
  85. // Operator+= -- Add in another EPOINTQF.
  86. VOID operator+=(EPOINTQF& ptqf)
  87. {
  88. x += ptqf.x;
  89. y += ptqf.y;
  90. }
  91. // Operator-= -- subtract another POINTQF.
  92. VOID operator-=(POINTQF& ptqf)
  93. {
  94. x -= *(LONGLONG*)&(ptqf.x);
  95. y -= *(LONGLONG*)&(ptqf.y);
  96. }
  97. // Operator*= -- multiply vector by a LONG number
  98. VOID operator*=(LONG l)
  99. {
  100. x *= l;
  101. y *= l;
  102. }
  103. // Operator*= -- divide vector by a LONG number
  104. VOID operator/=(LONG l)
  105. {
  106. x /= l;
  107. y /= l;
  108. }
  109. // vSetToZero -- make the null vetor
  110. VOID vSetToZero()
  111. {
  112. x = y = 0;
  113. }
  114. };