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.

47 lines
1.0 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // spanutil.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. #ifdef _X86_
  13. // warning C4035: 'imul32h' : no return value
  14. #pragma warning( disable : 4035 )
  15. #endif
  16. //-----------------------------------------------------------------------------
  17. //
  18. // imul32h
  19. //
  20. // Returns the upper 32 bits of a 32 bit by 32 bit signed multiply.
  21. //
  22. //-----------------------------------------------------------------------------
  23. inline INT32 imul32h(INT32 x, INT32 y)
  24. {
  25. #ifdef _X86_
  26. _asm
  27. {
  28. mov eax, x
  29. mov edx, y
  30. imul edx
  31. mov eax, edx
  32. }
  33. #else
  34. return (INT32)(((LONGLONG)x * y) >> 32);
  35. #endif
  36. }
  37. #ifdef _X86_
  38. // in general, we want to look at these warnings
  39. #pragma warning( default : 4035 )
  40. #endif
  41. #endif // #ifndef _SPANUTIL_H_