Commit f46e2394 authored by Alexandre Julliard's avatar Alexandre Julliard

kernelbase: Copy MulDiv() implementation instead of forwarding.

parent c4550534
......@@ -959,7 +959,7 @@
@ stdcall MoveFileExW(wstr wstr long)
# @ stub MoveFileWithProgressTransactedW
@ stdcall MoveFileWithProgressW(wstr wstr ptr ptr long)
@ stdcall MulDiv(long long long) kernel32.MulDiv
@ stdcall MulDiv(long long long)
@ stdcall MultiByteToWideChar(long long str long ptr long)
# @ stub NamedPipeEventEnum
# @ stub NamedPipeEventSelect
......
......@@ -63,6 +63,32 @@ BOOL WINAPI DllMainCRTStartup( HANDLE inst, DWORD reason, LPVOID reserved )
/***********************************************************************
* MulDiv (kernelbase.@)
*/
INT WINAPI MulDiv( INT a, INT b, INT c )
{
LONGLONG ret;
if (!c) return -1;
/* We want to deal with a positive divisor to simplify the logic. */
if (c < 0)
{
a = -a;
c = -c;
}
/* If the result is positive, we "add" to round. else, we subtract to round. */
if ((a < 0 && b < 0) || (a >= 0 && b >= 0))
ret = (((LONGLONG)a * b) + (c / 2)) / c;
else
ret = (((LONGLONG)a * b) - (c / 2)) / c;
if (ret > 2147483647 || ret < -2147483647) return -1;
return ret;
}
/***********************************************************************
* AppPolicyGetProcessTerminationMethod (KERNELBASE.@)
*/
LONG WINAPI AppPolicyGetProcessTerminationMethod(HANDLE token, AppPolicyProcessTerminationMethod *policy)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment