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.

71 lines
1.5 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // rspnutil.h
  4. //
  5. // Sundry span utility declarations.
  6. //
  7. // Copyright (C) Microsoft Corporation, 1997.
  8. //
  9. //----------------------------------------------------------------------------
  10. #ifndef _SPANUTIL_H_
  11. #define _SPANUTIL_H_
  12. extern UINT16 g_uRampDitherTable[16];
  13. #ifdef _X86_
  14. // warning C4035: 'imul32h' : no return value
  15. #pragma warning( disable : 4035 )
  16. #endif
  17. //-----------------------------------------------------------------------------
  18. //
  19. // imul32h
  20. //
  21. // Returns the upper 32 bits of a 32 bit by 32 bit signed multiply.
  22. //
  23. //-----------------------------------------------------------------------------
  24. inline INT32 imul32h(INT32 x, INT32 y)
  25. {
  26. #ifdef _X86_
  27. _asm
  28. {
  29. mov eax, x
  30. mov edx, y
  31. imul edx
  32. mov eax, edx
  33. }
  34. #else
  35. return (INT32)(((LONGLONG)x * y) >> 32);
  36. #endif
  37. }
  38. //-----------------------------------------------------------------------------
  39. //
  40. // imul32h_s20
  41. //
  42. // Returns (x*y)>>20
  43. //
  44. //-----------------------------------------------------------------------------
  45. inline INT32 imul32h_s20(INT32 x, INT32 y)
  46. {
  47. #ifdef _X86_
  48. _asm
  49. {
  50. mov eax, x
  51. mov edx, y
  52. imul edx
  53. shrd eax, edx, 20
  54. }
  55. #else
  56. return (INT32)(((LONGLONG)x * y) >> 20);
  57. #endif
  58. }
  59. #ifdef _X86_
  60. // in general, we want to look at these warnings
  61. #pragma warning( default : 4035 )
  62. #endif
  63. #endif // #ifndef _SPANUTIL_H_