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.

105 lines
3.2 KiB

  1. #ifndef ZQFROMZQ_DEFINED
  2. #define ZQFROMZQ_DEFINED
  3. #include "lsdefs.h"
  4. #define zqLim 1491309L /* higher resolution will overflow */
  5. long ZqFromZa_C (long, long);
  6. #ifdef _X86_
  7. long ZqFromZa_Asm (long, long);
  8. __int64 Div64_Asm (__int64, __int64);
  9. __int64 Mul64_Asm (__int64, __int64);
  10. #define ZqFromZa(dzqInch,za) ZqFromZa_Asm ((dzqInch),(za))
  11. #define Div64(DVND,DVSR) Div64_Asm ((DVND),(DVSR))
  12. #define Mul64(A,B) Mul64_Asm ((A),(B))
  13. #else
  14. #define ZqFromZa(dzqInch,za) ZqFromZa_C ((dzqInch),(za))
  15. #define Div64(DVND,DVSR) ((__int64) (DVND) / (__int64) (DVSR))
  16. #define Mul64(A,B) ((__int64) (A) * (__int64) (B))
  17. #endif
  18. long ZaFromZq(long, long);
  19. long LsLwMultDivR(long, long, long);
  20. #define I_UpFromUa(pdevres,ua) (ZqFromZa((pdevres)->dxpInch, (ua)))
  21. #define I_UrFromUa(pdevres,ua) (ZqFromZa((pdevres)->dxrInch, (ua)))
  22. #define I_VpFromVa(pdevres,va) (ZqFromZa((pdevres)->dypInch, (va)))
  23. #define I_VrFromVa(pdevres,va) (ZqFromZa((pdevres)->dyrInch, (va)))
  24. #define I_UaFromUp(pdevres,up) (ZaFromZq((pdevres)->dxpInch, (up)))
  25. #define I_VaFromVp(pdevres,vp) (ZaFromZq((pdevres)->dypInch, (vp)))
  26. #define I_UaFromUr(pdevres,ur) (ZaFromZq((pdevres)->dxrInch, (ur)))
  27. #define I_VaFromVr(pdevres,vr) (ZaFromZq((pdevres)->dyrInch, (vr)))
  28. #define UpFromUa(tfl,pdevres,ua) (((tfl) & fUVertical) ? \
  29. I_VpFromVa(pdevres,ua) :\
  30. I_UpFromUa(pdevres,ua) \
  31. )
  32. #define UrFromUa(tfl,pdevres,ua) (((tfl) & fUVertical) ? \
  33. I_VrFromVa(pdevres,ua) :\
  34. I_UrFromUa(pdevres,ua) \
  35. )
  36. #define VpFromVa(tfl,pdevres,va) ((tfl) & fUVertical) ? \
  37. I_UpFromUa(pdevres,va) :\
  38. I_VpFromVa(pdevres,va) \
  39. )
  40. #define VrFromVa(tfl,pdevres,va) (((tfl) & fUVertical) ? \
  41. I_UrFromUa(pdevres,va) :\
  42. I_VrFromVa(pdevres,va) \
  43. )
  44. #define UaFromUp(tfl,pdevres,up) (((tfl) & fUVertical) ? \
  45. I_VaFromVp(pdevres,up) :\
  46. I_UaFromUp(pdevres,up) \
  47. )
  48. #define VaFromVp(tfl,pdevres,vp) (((tfl) & fUVertical) ? \
  49. I_UaFromUp(pdevres,vp) :\
  50. I_VaFromVp(pdevres,vp) \
  51. )
  52. #define UaFromUr(tfl,pdevres,ur) (((tfl) & fUVertical) ? \
  53. I_VaFromVr(pdevres,ur) :\
  54. I_UaFromUr(pdevres,ur) \
  55. )
  56. #define VaFromVr(tfl,pdevres,vr) (((tfl) & fUVertical) ? \
  57. I_UaFromUr(pdevres,vr) :\
  58. I_VaFromVr(pdevres,vr) \
  59. )
  60. /*
  61. #define UpFromUr(pdevres,ur) UpFromUa(pdevres, UaFromUr(pdevres, ur))
  62. #define VpFromVr(pdevres,vr) VpFromVa(pdevres, VaFromVr(pdevres, vr))
  63. */
  64. #define UpFromUr(tfl,pdevres,ur) (((tfl) & fUVertical) ? \
  65. LsLwMultDivR(ur, (pdevres)->dypInch, (pdevres)->dyrInch): \
  66. LsLwMultDivR(ur, (pdevres)->dxpInch, (pdevres)->dxrInch) \
  67. )
  68. #define VpFromVr(tfl,pdevres,vr) (((tfl) & fUVertical) ? \
  69. LsLwMultDivR(vr, (pdevres)->dxpInch, (pdevres)->dxrInch): \
  70. LsLwMultDivR(vr, (pdevres)->dypInch, (pdevres)->dyrInch) \
  71. )
  72. #define UrFromUp(tfl,pdevres,up) (((tfl) & fUVertical) ? \
  73. LsLwMultDivR(up, (pdevres)->dyrInch, (pdevres)->dypInch): \
  74. LsLwMultDivR(up, (pdevres)->dxrInch, (pdevres)->dxpInch) \
  75. )
  76. #define VrFromVp(tfl,pdevres,vp) (((tfl) & fUVertical) ? \
  77. LsLwMultDivR(vp, (pdevres)->dxrInch, (pdevres)->dxpInch): \
  78. LsLwMultDivR(vp, (pdevres)->dyrInch, (pdevres)->dypInch) \
  79. )
  80. #endif /* ZQFROMZQ_DEFINED */