winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
May 2021
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
770 discussions
Start a n
N
ew thread
Rémi Bernon : dinput: Free axis_map when joystick device is freed.
by Alexandre Julliard
31 May '21
31 May '21
Module: wine Branch: master Commit: 5cf67f00d0e4d157fb08ac56cb9d8066c57a7be2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5cf67f00d0e4d157fb08ac56…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon May 31 10:23:58 2021 +0200 dinput: Free axis_map when joystick device is freed. Wine-Bug:
https://bugs.winehq.org//show_bug.cgi?id=36263
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/joystick.c | 11 +++++++++++ dlls/dinput/joystick_linux.c | 2 +- dlls/dinput/joystick_linuxinput.c | 2 +- dlls/dinput/joystick_osx.c | 2 +- dlls/dinput/joystick_private.h | 2 ++ 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/dlls/dinput/joystick.c b/dlls/dinput/joystick.c index a68c4df20e6..8ea7850621c 100644 --- a/dlls/dinput/joystick.c +++ b/dlls/dinput/joystick.c @@ -534,6 +534,17 @@ HRESULT WINAPI JoystickWGenericImpl_GetCapabilities(LPDIRECTINPUTDEVICE8W iface, return DI_OK; } + +ULONG WINAPI JoystickWGenericImpl_Release(LPDIRECTINPUTDEVICE8W iface) +{ + JoystickGenericImpl *This = impl_from_IDirectInputDevice8W(iface); + void *axis_map = This->axis_map; + ULONG res = IDirectInputDevice2WImpl_Release(iface); + if (!res) HeapFree(GetProcessHeap(), 0, axis_map); + return res; +} + + /****************************************************************************** * GetObjectInfo : get object info */ diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c index 5a88e643e07..3215978c995 100644 --- a/dlls/dinput/joystick_linux.c +++ b/dlls/dinput/joystick_linux.c @@ -786,7 +786,7 @@ static const IDirectInputDevice8WVtbl JoystickWvt = { IDirectInputDevice2WImpl_QueryInterface, IDirectInputDevice2WImpl_AddRef, - IDirectInputDevice2WImpl_Release, + JoystickWGenericImpl_Release, JoystickWGenericImpl_GetCapabilities, IDirectInputDevice2WImpl_EnumObjects, JoystickLinuxWImpl_GetProperty, diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index 488e9c04759..2b970271ec3 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -1231,7 +1231,7 @@ static const IDirectInputDevice8WVtbl JoystickWvt = { IDirectInputDevice2WImpl_QueryInterface, IDirectInputDevice2WImpl_AddRef, - IDirectInputDevice2WImpl_Release, + JoystickWGenericImpl_Release, JoystickWGenericImpl_GetCapabilities, IDirectInputDevice2WImpl_EnumObjects, JoystickWImpl_GetProperty, diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c index 6d37a476380..27a47b07639 100644 --- a/dlls/dinput/joystick_osx.c +++ b/dlls/dinput/joystick_osx.c @@ -1484,7 +1484,7 @@ static const IDirectInputDevice8WVtbl JoystickWvt = { IDirectInputDevice2WImpl_QueryInterface, IDirectInputDevice2WImpl_AddRef, - IDirectInputDevice2WImpl_Release, + JoystickWGenericImpl_Release, JoystickWGenericImpl_GetCapabilities, IDirectInputDevice2WImpl_EnumObjects, JoystickWImpl_GetProperty, diff --git a/dlls/dinput/joystick_private.h b/dlls/dinput/joystick_private.h index 78d5d721808..874bf3e69a7 100644 --- a/dlls/dinput/joystick_private.h +++ b/dlls/dinput/joystick_private.h @@ -59,6 +59,8 @@ DWORD joystick_map_pov(const POINTL *p) DECLSPEC_HIDDEN; BOOL device_disabled_registry(const char* name) DECLSPEC_HIDDEN; +ULONG WINAPI JoystickWGenericImpl_Release(LPDIRECTINPUTDEVICE8W iface); + HRESULT WINAPI JoystickWGenericImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow) DECLSPEC_HIDDEN;
1
0
0
0
Rémi Bernon : dinput: Prevent a device interface leak when enumerating.
by Alexandre Julliard
31 May '21
31 May '21
Module: wine Branch: master Commit: 52aacd2377c68097ea165fdfff188fd6768fcc4c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=52aacd2377c68097ea165fdf…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon May 31 10:23:57 2021 +0200 dinput: Prevent a device interface leak when enumerating. Wine-Bug:
https://bugs.winehq.org//show_bug.cgi?id=36263
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/dinput_main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 62e70e0535c..c7b932aca44 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -864,8 +864,10 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics( if (lpCallback(&didevis[i], lpdid, callbackFlags, --remain, pvRef) == DIENUM_STOP) { HeapFree(GetProcessHeap(), 0, didevis); + IDirectInputDevice_Release(lpdid); return DI_OK; } + IDirectInputDevice_Release(lpdid); } HeapFree(GetProcessHeap(), 0, didevis); @@ -883,7 +885,11 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics( IDirectInputDevice_GetDeviceInfo(lpdid, &didevi); if (lpCallback(&didevi, lpdid, callbackFlags, --remain, pvRef) == DIENUM_STOP) + { + IDirectInputDevice_Release(lpdid); return DI_OK; + } + IDirectInputDevice_Release(lpdid); } }
1
0
0
0
Rémi Bernon : dinput: Remove the need for ANSI enum_device callback.
by Alexandre Julliard
31 May '21
31 May '21
Module: wine Branch: master Commit: d666aea3607ef3398744b3daec7f266cc25a2cd9 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d666aea3607ef3398744b3da…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon May 31 10:23:56 2021 +0200 dinput: Remove the need for ANSI enum_device callback. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/dinput_main.c | 14 +++++----- dlls/dinput/dinput_private.h | 3 +- dlls/dinput/joystick_linux.c | 58 ++------------------------------------- dlls/dinput/joystick_linuxinput.c | 54 ++---------------------------------- dlls/dinput/joystick_osx.c | 52 ++--------------------------------- dlls/dinput/keyboard.c | 50 ++------------------------------- dlls/dinput/mouse.c | 50 ++------------------------------- 7 files changed, 18 insertions(+), 263 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=d666aea3607ef3398744…
1
0
0
0
Rémi Bernon : dinput: Factor out device creation interface queries.
by Alexandre Julliard
31 May '21
31 May '21
Module: wine Branch: master Commit: 17958bc8631c574df3cf83343d3a813d2bc81128 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=17958bc8631c574df3cf8334…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon May 31 10:23:55 2021 +0200 dinput: Factor out device creation interface queries. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/dinput_main.c | 32 +++++++++++++++----------------- dlls/dinput/dinput_private.h | 2 +- dlls/dinput/joystick_linux.c | 34 ++++------------------------------ dlls/dinput/joystick_linuxinput.c | 34 ++++------------------------------ dlls/dinput/joystick_osx.c | 33 ++++----------------------------- dlls/dinput/keyboard.c | 35 ++++------------------------------- dlls/dinput/mouse.c | 34 ++++------------------------------ 7 files changed, 36 insertions(+), 168 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=17958bc8631c574df3cf…
1
0
0
0
Roberto Pungartnik : po: Update Brazilian Portuguese translation.
by Alexandre Julliard
31 May '21
31 May '21
Module: wine Branch: master Commit: 96ab7b4430011153734119b3ef969f363aef0634 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=96ab7b4430011153734119b3…
Author: Roberto Pungartnik <rpungartnik(a)gmail.com> Date: Sat May 29 16:51:39 2021 -0300 po: Update Brazilian Portuguese translation. Signed-off-by: Bob <rpungartnik(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- po/pt_BR.po | 633 +++++++++++++++++++++++++++++++----------------------------- 1 file changed, 330 insertions(+), 303 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=96ab7b44300111537341…
1
0
0
0
Piotr Caban : msvcrt: Import tanhf implementation from musl.
by Alexandre Julliard
31 May '21
31 May '21
Module: wine Branch: master Commit: bb9f97c4d13151d05ebb6aa24c3e0f6b8cab7bb3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=bb9f97c4d13151d05ebb6aa2…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Sat May 29 19:13:55 2021 +0200 msvcrt: Import tanhf implementation from musl. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcrt/math.c | 40 +++++++++++++++++++++++++++++++++++++--- dlls/msvcrt/unixlib.c | 9 --------- dlls/msvcrt/unixlib.h | 1 - 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 6d60a6fa086..0bace98cd7d 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -1512,9 +1512,43 @@ float CDECL tanf( float x ) */ float CDECL tanhf( float x ) { - float ret = unix_funcs->tanhf(x); - if (!isfinite(x)) return math_error(_DOMAIN, "tanhf", x, 0, ret); - return ret; + UINT32 ui = *(UINT32*)&x; + int sign; + float t; + + /* x = |x| */ + sign = ui >> 31; + ui &= 0x7fffffff; + x = *(float*)&ui; + + if (ui > 0x3f0c9f54) { + /* |x| > log(3)/2 ~= 0.5493 or nan */ + if (ui > 0x41200000) { +#if _MSVCR_VER < 140 + if (isnan(x)) + return math_error(_DOMAIN, "tanhf", x, 0, x); +#endif + /* |x| > 10 */ + fp_barrierf(x + 0x1p120f); + t = 1 + 0 / x; + } else { + t = __expm1f(2 * x); + t = 1 - 2 / (t + 2); + } + } else if (ui > 0x3e82c578) { + /* |x| > log(5/3)/2 ~= 0.2554 */ + t = __expm1f(2 * x); + t = t / (t + 2); + } else if (ui >= 0x00800000) { + /* |x| >= 0x1p-126 */ + t = __expm1f(-2 * x); + t = -t / (t + 2); + } else { + /* |x| is subnormal */ + fp_barrierf(x * x); + t = x; + } + return sign ? -t : t; } /********************************************************************* diff --git a/dlls/msvcrt/unixlib.c b/dlls/msvcrt/unixlib.c index ce4a3eed094..d92203c1ab7 100644 --- a/dlls/msvcrt/unixlib.c +++ b/dlls/msvcrt/unixlib.c @@ -268,14 +268,6 @@ static float CDECL unix_powf( float x, float y ) return powf( x, y ); } -/********************************************************************* - * tanhf - */ -static float CDECL unix_tanhf( float x ) -{ - return tanhf( x ); -} - /********************************************************************* * tgamma */ @@ -327,7 +319,6 @@ static const struct unix_funcs funcs = unix_log2f, unix_pow, unix_powf, - unix_tanhf, unix_tgamma, unix_tgammaf, }; diff --git a/dlls/msvcrt/unixlib.h b/dlls/msvcrt/unixlib.h index a95aae74dea..a01ce285106 100644 --- a/dlls/msvcrt/unixlib.h +++ b/dlls/msvcrt/unixlib.h @@ -46,7 +46,6 @@ struct unix_funcs float (CDECL *log2f)(float x); double (CDECL *pow)(double x, double y); float (CDECL *powf)(float x, float y); - float (CDECL *tanhf)(float x); double (CDECL *tgamma)(double x); float (CDECL *tgammaf)(float x); };
1
0
0
0
Piotr Caban : msvcrt: Import tanh implementation from musl.
by Alexandre Julliard
31 May '21
31 May '21
Module: wine Branch: master Commit: 3171dccbef835f85852c50e3dc3f37337e76932c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3171dccbef835f85852c50e3…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Sat May 29 19:13:52 2021 +0200 msvcrt: Import tanh implementation from musl. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcrt/math.c | 44 +++++++++++++++++++++++++++++++++++++++++--- dlls/msvcrt/unixlib.c | 9 --------- dlls/msvcrt/unixlib.h | 1 - 3 files changed, 41 insertions(+), 13 deletions(-) diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 05571a7fe20..6d60a6fa086 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -2834,9 +2834,47 @@ double CDECL tan( double x ) */ double CDECL tanh( double x ) { - double ret = unix_funcs->tanh(x); - if (isnan(x)) return math_error(_DOMAIN, "tanh", x, 0, ret); - return ret; + UINT64 ui = *(UINT64*)&x; + UINT32 w; + int sign; + double t; + + /* x = |x| */ + sign = ui >> 63; + ui &= (UINT64)-1 / 2; + x = *(double*)&ui; + w = ui >> 32; + + if (w > 0x3fe193ea) { + /* |x| > log(3)/2 ~= 0.5493 or nan */ + if (w > 0x40340000) { +#if _MSVCR_VER < 140 + if (isnan(x)) + return math_error(_DOMAIN, "tanh", x, 0, x); +#endif + /* |x| > 20 or nan */ + /* note: this branch avoids raising overflow */ + fp_barrier(x + 0x1p120f); + t = 1 - 0 / x; + } else { + t = __expm1(2 * x); + t = 1 - 2 / (t + 2); + } + } else if (w > 0x3fd058ae) { + /* |x| > log(5/3)/2 ~= 0.2554 */ + t = __expm1(2 * x); + t = t / (t + 2); + } else if (w >= 0x00100000) { + /* |x| >= 0x1p-1022, up to 2ulp error in [0.1,0.2554] */ + t = __expm1(-2 * x); + t = -t / (t + 2); + } else { + /* |x| is subnormal */ + /* note: the branch above would not raise underflow in [0x1p-1023,0x1p-1022) */ + fp_barrier((float)x); + t = x; + } + return sign ? -t : t; } diff --git a/dlls/msvcrt/unixlib.c b/dlls/msvcrt/unixlib.c index 918c7e6ed71..ce4a3eed094 100644 --- a/dlls/msvcrt/unixlib.c +++ b/dlls/msvcrt/unixlib.c @@ -268,14 +268,6 @@ static float CDECL unix_powf( float x, float y ) return powf( x, y ); } -/********************************************************************* - * tanh - */ -static double CDECL unix_tanh( double x ) -{ - return tanh( x ); -} - /********************************************************************* * tanhf */ @@ -335,7 +327,6 @@ static const struct unix_funcs funcs = unix_log2f, unix_pow, unix_powf, - unix_tanh, unix_tanhf, unix_tgamma, unix_tgammaf, diff --git a/dlls/msvcrt/unixlib.h b/dlls/msvcrt/unixlib.h index 0e3074be0c5..a95aae74dea 100644 --- a/dlls/msvcrt/unixlib.h +++ b/dlls/msvcrt/unixlib.h @@ -46,7 +46,6 @@ struct unix_funcs float (CDECL *log2f)(float x); double (CDECL *pow)(double x, double y); float (CDECL *powf)(float x, float y); - double (CDECL *tanh)(double x); float (CDECL *tanhf)(float x); double (CDECL *tgamma)(double x); float (CDECL *tgammaf)(float x);
1
0
0
0
Piotr Caban : msvcrt: Import sinhf implementation from musl.
by Alexandre Julliard
31 May '21
31 May '21
Module: wine Branch: master Commit: ae48d58362d92b378cb47e07b46ff16cb156fd68 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ae48d58362d92b378cb47e07…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Sat May 29 19:13:49 2021 +0200 msvcrt: Import sinhf implementation from musl. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcrt/math.c | 27 ++++++++++++++++++++++++--- dlls/msvcrt/unixlib.c | 9 --------- dlls/msvcrt/unixlib.h | 1 - 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 5ecbb8bf037..05571a7fe20 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -1312,9 +1312,30 @@ float CDECL sinf( float x ) */ float CDECL sinhf( float x ) { - float ret = unix_funcs->sinhf( x ); - if (isnan(x)) return math_error(_DOMAIN, "sinhf", x, 0, ret); - return ret; + UINT32 ui = *(UINT32*)&x; + float t, h, absx; + + h = 0.5; + if (ui >> 31) + h = -h; + /* |x| */ + ui &= 0x7fffffff; + absx = *(float*)&ui; + + /* |x| < log(FLT_MAX) */ + if (ui < 0x42b17217) { + t = __expm1f(absx); + if (ui < 0x3f800000) { + if (ui < 0x3f800000 - (12 << 23)) + return x; + return h * (2 * t - t * t / (t + 1)); + } + return h * (t + t / (t + 1)); + } + + /* |x| > logf(FLT_MAX) or nan */ + t = __expo2f(absx, 2 * h); + return t; } static BOOL sqrtf_validate( float *x ) diff --git a/dlls/msvcrt/unixlib.c b/dlls/msvcrt/unixlib.c index 2f447533fb6..918c7e6ed71 100644 --- a/dlls/msvcrt/unixlib.c +++ b/dlls/msvcrt/unixlib.c @@ -268,14 +268,6 @@ static float CDECL unix_powf( float x, float y ) return powf( x, y ); } -/********************************************************************* - * sinhf - */ -static float CDECL unix_sinhf( float x ) -{ - return sinhf( x ); -} - /********************************************************************* * tanh */ @@ -343,7 +335,6 @@ static const struct unix_funcs funcs = unix_log2f, unix_pow, unix_powf, - unix_sinhf, unix_tanh, unix_tanhf, unix_tgamma, diff --git a/dlls/msvcrt/unixlib.h b/dlls/msvcrt/unixlib.h index 80a150b9031..0e3074be0c5 100644 --- a/dlls/msvcrt/unixlib.h +++ b/dlls/msvcrt/unixlib.h @@ -46,7 +46,6 @@ struct unix_funcs float (CDECL *log2f)(float x); double (CDECL *pow)(double x, double y); float (CDECL *powf)(float x, float y); - float (CDECL *sinhf)(float x); double (CDECL *tanh)(double x); float (CDECL *tanhf)(float x); double (CDECL *tgamma)(double x);
1
0
0
0
Piotr Caban : msvcrt: Import sinh implementation from musl.
by Alexandre Julliard
31 May '21
31 May '21
Module: wine Branch: master Commit: 739d4f0c943732b88ee135884a51ccd272c46047 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=739d4f0c943732b88ee13588…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Sat May 29 19:13:46 2021 +0200 msvcrt: Import sinh implementation from musl. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcrt/math.c | 30 +++++++++++++++++++++++++++--- dlls/msvcrt/unixlib.c | 9 --------- dlls/msvcrt/unixlib.h | 1 - 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 9aadc6dea1e..5ecbb8bf037 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -2527,9 +2527,33 @@ double CDECL sin( double x ) */ double CDECL sinh( double x ) { - double ret = unix_funcs->sinh( x ); - if (isnan(x)) return math_error(_DOMAIN, "sinh", x, 0, ret); - return ret; + UINT64 ux = *(UINT64*)&x; + UINT32 w; + double t, h, absx; + + h = 0.5; + if (ux >> 63) + h = -h; + /* |x| */ + ux &= (UINT64)-1 / 2; + absx = *(double*)&ux; + w = ux >> 32; + + /* |x| < log(DBL_MAX) */ + if (w < 0x40862e42) { + t = __expm1(absx); + if (w < 0x3ff00000) { + if (w < 0x3ff00000 - (26 << 20)) + return x; + return h * (2 * t - t * t / (t + 1)); + } + return h * (t + t / (t + 1)); + } + + /* |x| > log(DBL_MAX) or nan */ + /* note: the result is stored to handle overflow */ + t = __expo2(absx, 2 * h); + return t; } static BOOL sqrt_validate( double *x, BOOL update_sw ) diff --git a/dlls/msvcrt/unixlib.c b/dlls/msvcrt/unixlib.c index e5e4233d12f..2f447533fb6 100644 --- a/dlls/msvcrt/unixlib.c +++ b/dlls/msvcrt/unixlib.c @@ -268,14 +268,6 @@ static float CDECL unix_powf( float x, float y ) return powf( x, y ); } -/********************************************************************* - * sinh - */ -static double CDECL unix_sinh( double x ) -{ - return sinh( x ); -} - /********************************************************************* * sinhf */ @@ -351,7 +343,6 @@ static const struct unix_funcs funcs = unix_log2f, unix_pow, unix_powf, - unix_sinh, unix_sinhf, unix_tanh, unix_tanhf, diff --git a/dlls/msvcrt/unixlib.h b/dlls/msvcrt/unixlib.h index 4c30fc220fe..80a150b9031 100644 --- a/dlls/msvcrt/unixlib.h +++ b/dlls/msvcrt/unixlib.h @@ -46,7 +46,6 @@ struct unix_funcs float (CDECL *log2f)(float x); double (CDECL *pow)(double x, double y); float (CDECL *powf)(float x, float y); - double (CDECL *sinh)(double x); float (CDECL *sinhf)(float x); double (CDECL *tanh)(double x); float (CDECL *tanhf)(float x);
1
0
0
0
Piotr Caban : msvcrt: Import coshf implementation from musl.
by Alexandre Julliard
31 May '21
31 May '21
Module: wine Branch: master Commit: c395ec77d7b1b601def6324778535fea0fabd525 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c395ec77d7b1b601def63247…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Sat May 29 19:13:43 2021 +0200 msvcrt: Import coshf implementation from musl. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcrt/math.c | 216 ++++++++++++++++++++++++++++++-------------------- dlls/msvcrt/unixlib.c | 9 --- dlls/msvcrt/unixlib.h | 1 - 3 files changed, 129 insertions(+), 97 deletions(-) diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 760f3834761..9aadc6dea1e 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -549,6 +549,95 @@ recompute: return n & 7; } +#if !defined(__i386__) || _MSVCR_VER >= 120 +/* Copied from musl: src/math/expm1f.c */ +static float __expm1f(float x) +{ + static const float ln2_hi = 6.9313812256e-01, + ln2_lo = 9.0580006145e-06, + invln2 = 1.4426950216e+00, + Q1 = -3.3333212137e-2, + Q2 = 1.5807170421e-3; + + float y, hi, lo, c, t, e, hxs, hfx, r1, twopk; + union {float f; UINT32 i;} u = {x}; + UINT32 hx = u.i & 0x7fffffff; + int k, sign = u.i >> 31; + + /* filter out huge and non-finite argument */ + if (hx >= 0x4195b844) { /* if |x|>=27*ln2 */ + if (hx >= 0x7f800000) /* NaN */ + return u.i == 0xff800000 ? -1 : x; + if (sign) + return math_error(_UNDERFLOW, "exp", x, 0, -1); + if (hx > 0x42b17217) /* x > log(FLT_MAX) */ + return math_error(_OVERFLOW, "exp", x, 0, fp_barrierf(x * FLT_MAX)); + } + + /* argument reduction */ + if (hx > 0x3eb17218) { /* if |x| > 0.5 ln2 */ + if (hx < 0x3F851592) { /* and |x| < 1.5 ln2 */ + if (!sign) { + hi = x - ln2_hi; + lo = ln2_lo; + k = 1; + } else { + hi = x + ln2_hi; + lo = -ln2_lo; + k = -1; + } + } else { + k = invln2 * x + (sign ? -0.5f : 0.5f); + t = k; + hi = x - t * ln2_hi; /* t*ln2_hi is exact here */ + lo = t * ln2_lo; + } + x = hi - lo; + c = (hi - x) - lo; + } else if (hx < 0x33000000) { /* when |x|<2**-25, return x */ + if (hx < 0x00800000) + fp_barrierf(x * x); + return x; + } else + k = 0; + + /* x is now in primary range */ + hfx = 0.5f * x; + hxs = x * hfx; + r1 = 1.0f + hxs * (Q1 + hxs * Q2); + t = 3.0f - r1 * hfx; + e = hxs * ((r1 - t) / (6.0f - x * t)); + if (k == 0) /* c is 0 */ + return x - (x * e - hxs); + e = x * (e - c) - c; + e -= hxs; + /* exp(x) ~ 2^k (x_reduced - e + 1) */ + if (k == -1) + return 0.5f * (x - e) - 0.5f; + if (k == 1) { + if (x < -0.25f) + return -2.0f * (e - (x + 0.5f)); + return 1.0f + 2.0f * (x - e); + } + u.i = (0x7f + k) << 23; /* 2^k */ + twopk = u.f; + if (k < 0 || k > 56) { /* suffice to return exp(x)-1 */ + y = x - e + 1.0f; + if (k == 128) + y = y * 2.0f * 0x1p127f; + else + y = y * twopk; + return y - 1.0f; + } + u.i = (0x7f-k) << 23; /* 2^-k */ + if (k < 23) + y = (x - e + (1 - u.f)) * twopk; + else + y = (x - (e + u.f) + 1) * twopk; + return y; +} +#endif + #ifndef __i386__ /********************************************************************* @@ -994,14 +1083,50 @@ float CDECL cosf( float x ) } } +/* Copied from musl: src/math/__expo2f.c */ +static float __expo2f(float x, float sign) +{ + static const int k = 235; + static const float kln2 = 0x1.45c778p+7f; + float scale; + + *(UINT32*)&scale = (UINT32)(0x7f + k/2) << 23; + return expf(x - kln2) * (sign * scale) * scale; +} + /********************************************************************* * coshf (MSVCRT.@) + * + * Copied from musl: src/math/coshf.c */ float CDECL coshf( float x ) { - float ret = unix_funcs->coshf( x ); - if (isnan(x)) return math_error(_DOMAIN, "coshf", x, 0, ret); - return ret; + UINT32 ui = *(UINT32*)&x; + float t; + + /* |x| */ + ui &= 0x7fffffff; + x = *(float*)&ui; + + /* |x| < log(2) */ + if (ui < 0x3f317217) { + if (ui < 0x3f800000 - (12 << 23)) { + fp_barrierf(x + 0x1p120f); + return 1; + } + t = __expm1f(x); + return 1 + t * t / (2 * (1 + t)); + } + + /* |x| < log(FLT_MAX) */ + if (ui < 0x42b17217) { + t = expf(x); + return 0.5f * (t + 1 / t); + } + + /* |x| > log(FLT_MAX) or nan */ + t = __expo2f(x, 1.0f); + return t; } /********************************************************************* @@ -5899,93 +6024,10 @@ double CDECL expm1(double x) /********************************************************************* * expm1f (MSVCR120.@) - * - * Copied from musl: src/math/expm1f.c */ float CDECL expm1f(float x) { - static const float ln2_hi = 6.9313812256e-01, - ln2_lo = 9.0580006145e-06, - invln2 = 1.4426950216e+00, - Q1 = -3.3333212137e-2, - Q2 = 1.5807170421e-3; - - float y, hi, lo, c, t, e, hxs, hfx, r1, twopk; - union {float f; UINT32 i;} u = {x}; - UINT32 hx = u.i & 0x7fffffff; - int k, sign = u.i >> 31; - - /* filter out huge and non-finite argument */ - if (hx >= 0x4195b844) { /* if |x|>=27*ln2 */ - if (hx >= 0x7f800000) /* NaN */ - return u.i == 0xff800000 ? -1 : x; - if (sign) - return math_error(_UNDERFLOW, "exp", x, 0, -1); - if (hx > 0x42b17217) /* x > log(FLT_MAX) */ - return math_error(_OVERFLOW, "exp", x, 0, fp_barrierf(x * FLT_MAX)); - } - - /* argument reduction */ - if (hx > 0x3eb17218) { /* if |x| > 0.5 ln2 */ - if (hx < 0x3F851592) { /* and |x| < 1.5 ln2 */ - if (!sign) { - hi = x - ln2_hi; - lo = ln2_lo; - k = 1; - } else { - hi = x + ln2_hi; - lo = -ln2_lo; - k = -1; - } - } else { - k = invln2 * x + (sign ? -0.5f : 0.5f); - t = k; - hi = x - t * ln2_hi; /* t*ln2_hi is exact here */ - lo = t * ln2_lo; - } - x = hi - lo; - c = (hi - x) - lo; - } else if (hx < 0x33000000) { /* when |x|<2**-25, return x */ - if (hx < 0x00800000) - fp_barrierf(x * x); - return x; - } else - k = 0; - - /* x is now in primary range */ - hfx = 0.5f * x; - hxs = x * hfx; - r1 = 1.0f + hxs * (Q1 + hxs * Q2); - t = 3.0f - r1 * hfx; - e = hxs * ((r1 - t) / (6.0f - x * t)); - if (k == 0) /* c is 0 */ - return x - (x * e - hxs); - e = x * (e - c) - c; - e -= hxs; - /* exp(x) ~ 2^k (x_reduced - e + 1) */ - if (k == -1) - return 0.5f * (x - e) - 0.5f; - if (k == 1) { - if (x < -0.25f) - return -2.0f * (e - (x + 0.5f)); - return 1.0f + 2.0f * (x - e); - } - u.i = (0x7f + k) << 23; /* 2^k */ - twopk = u.f; - if (k < 0 || k > 56) { /* suffice to return exp(x)-1 */ - y = x - e + 1.0f; - if (k == 128) - y = y * 2.0f * 0x1p127f; - else - y = y * twopk; - return y - 1.0f; - } - u.i = (0x7f-k) << 23; /* 2^-k */ - if (k < 23) - y = (x - e + (1 - u.f)) * twopk; - else - y = (x - (e + u.f) + 1) * twopk; - return y; + return __expm1f(x); } /********************************************************************* diff --git a/dlls/msvcrt/unixlib.c b/dlls/msvcrt/unixlib.c index 6af252e5e9b..e5e4233d12f 100644 --- a/dlls/msvcrt/unixlib.c +++ b/dlls/msvcrt/unixlib.c @@ -42,14 +42,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); -/********************************************************************* - * coshf - */ -static float CDECL unix_coshf( float x ) -{ - return coshf( x ); -} - /********************************************************************* * exp */ @@ -336,7 +328,6 @@ static float CDECL unix_tgammaf(float x) static const struct unix_funcs funcs = { - unix_coshf, unix_exp, unix_expf, unix_exp2, diff --git a/dlls/msvcrt/unixlib.h b/dlls/msvcrt/unixlib.h index 67dd1f98b84..4c30fc220fe 100644 --- a/dlls/msvcrt/unixlib.h +++ b/dlls/msvcrt/unixlib.h @@ -23,7 +23,6 @@ struct unix_funcs { - float (CDECL *coshf)(float x); double (CDECL *exp)(double x); float (CDECL *expf)(float x); double (CDECL *exp2)(double x);
1
0
0
0
← Newer
1
2
3
4
5
6
7
...
77
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
Results per page:
10
25
50
100
200