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.

58 lines
1.7 KiB

  1. //==========================================================================;
  2. //
  3. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4. // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5. // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6. // PURPOSE.
  7. //
  8. // Copyright (c) 1993, 1994 Microsoft Corporation. All Rights Reserved.
  9. //
  10. //--------------------------------------------------------------------------;
  11. //
  12. // muldiv32.h
  13. //
  14. // Description: math routines for 32 bit signed and unsiged numbers.
  15. //
  16. // MulDiv32(a,b,c) = (a * b) / c (round down, signed)
  17. //
  18. // MulDivRD(a,b,c) = (a * b) / c (round down, unsigned)
  19. // MulDivRN(a,b,c) = (a * b + c/2) / c (round nearest, unsigned)
  20. // MulDivRU(a,b,c) = (a * b + c-1) / c (round up, unsigned)
  21. //
  22. // Description:
  23. //
  24. // History:
  25. // 9/21/93 cjp [curtisp]
  26. // 9/23/93 stl [toddla]
  27. //
  28. //==========================================================================;
  29. #ifndef _INC_MULDIV32
  30. #define _INC_MULDIV32
  31. #ifdef __cplusplus
  32. extern "C"
  33. {
  34. #endif
  35. extern LONG FAR PASCAL MulDiv32(LONG a,LONG b,LONG c);
  36. extern DWORD FAR PASCAL MulDivRN(DWORD a,DWORD b,DWORD c);
  37. extern DWORD FAR PASCAL MulDivRD(DWORD a,DWORD b,DWORD c);
  38. extern DWORD FAR PASCAL MulDivRU(DWORD a,DWORD b,DWORD c);
  39. #if defined(WIN32) || defined(_WIN32)
  40. // GDI32s MulDiv is the same as MulDivRN
  41. #define MulDivRN(a,b,c) (DWORD)MulDiv((LONG)(a),(LONG)(b),(LONG)(c))
  42. #endif
  43. //
  44. // some code references these by other names.
  45. //
  46. #define muldiv32 MulDivRN
  47. #define muldivrd32 MulDivRD
  48. #define muldivru32 MulDivRU
  49. #ifdef __cplusplus
  50. }
  51. #endif
  52. #endif // _INC_MULDIV32