History

Finalizing math.h fixes: - Updated msvcrt.def with symbols from 64bit version of dll - it contains the float math functions missing in the 32bit dll. - Made sure this patch only apply to to WIN32 and WIN64. For WIN32 float functions calls the double variants, on 64bit they are called natively.

Tyge committed 6 years ago

Commit 024214a1 parent df67d862 files · +131 −171Browse files

Unified · Split

2 files
  1. win32/include/math.h +41 −2
  2. win32/lib/msvcrt.def +90 −169
win32/include/math.h+41−2
@@ -205,8 +205,21 @@ extern "C" { · 204 unmodified lines
205205 __CRT_INLINE float frexpf(float _X,int *_Y) { return ((float)frexp((double)_X,_Y)); }
206206
207207 #if !defined (__ia64__)
208− __CRT_INLINE float fabsf(float x) { return (float) fabs(x); }
209− __CRT_INLINE float ldexpf(float x, int expn) { return (float) ldexp(x, expn); }
208+ __CRT_INLINE float __cdecl fabsf (float x)
209+ {
210+#ifdef _WIN64
211+ *((int *) &x) &= 0x7fffffff;
212+ return x;
213+#else
214+ float res;
215+ __asm__ ("fabs;" : "=t" (res) : "0" (x));
216+ return res;
217+#endif
218+ }
219+
220+ __CRT_INLINE float __cdecl ldexpf (float x, int expn) { return (float) ldexp (x, expn); }
221+#endif
222+#if defined (_WIN32) && !defined(_WIN64)
210223 __CRT_INLINE float acosf(float x) { return (float) acos(x); }
211224 __CRT_INLINE float asinf(float x) { return (float) asin(x); }
212225 __CRT_INLINE float atanf(float x) { return (float) atan(x); }
@@ -377,6 +390,32 @@ extern "C" { · 164 unmodified lines
377390 extern double __cdecl logb (double);
378391 extern float __cdecl logbf (float);
379392 extern long double __cdecl logbl (long double);
393+#ifndef _WIN32
394+ __CRT_INLINE double __cdecl logb (double x)
395+ {
396+ double res;
397+ __asm__ ("fxtract\n\t"
398+ "fstp %%st" : "=t" (res) : "0" (x));
399+ return res;
400+ }
401+
402+ __CRT_INLINE float __cdecl logbf (float x)
403+ {
404+ float res;
405+ __asm__ ("fxtract\n\t"
406+ "fstp %%st" : "=t" (res) : "0" (x));
407+ return res;
408+ }
409+
410+ __CRT_INLINE long double __cdecl logbl (long double x)
411+ {
412+ long double res;
413+ __asm__ ("fxtract\n\t"
414+ "fstp %%st" : "=t" (res) : "0" (x));
415+ return res;
416+ }
417+#endif
418+
380419 extern long double __cdecl modfl (long double, long double*);
381420
382421 /* 7.12.6.13 */
win32/lib/msvcrt.def+90−169
@@ -1,80 +1,57 @@
11 LIBRARY msvcrt.dll
22
33 EXPORTS
4−$I10_OUTPUT
5−??0__non_rtti_object@@QAE@ABV0@@Z
6−??0__non_rtti_object@@QAE@PBD@Z
4+??0__non_rtti_object@@QEAA@AEBV0@@Z
5+??0__non_rtti_object@@QEAA@PEBD@Z
76 ??0bad_cast@@AAE@PBQBD@Z
7+??0bad_cast@@AEAA@PEBQEBD@Z
88 ??0bad_cast@@QAE@ABQBD@Z
9−??0bad_cast@@QAE@ABV0@@Z
10−??0bad_cast@@QAE@PBD@Z
11−??0bad_typeid@@QAE@ABV0@@Z
12−??0bad_typeid@@QAE@PBD@Z
13−??0exception@@QAE@ABQBD@Z
14−??0exception@@QAE@ABQBDH@Z
15−??0exception@@QAE@ABV0@@Z
16−??0exception@@QAE@XZ
17−??1__non_rtti_object@@UAE@XZ
18−??1bad_cast@@UAE@XZ
19−??1bad_typeid@@UAE@XZ
20−??1exception@@UAE@XZ
21−??1type_info@@UAE@XZ
22−??2@YAPAXI@Z
23−??2@YAPAXIHPBDH@Z
24−??3@YAXPAX@Z
25−??4__non_rtti_object@@QAEAAV0@ABV0@@Z
26−??4bad_cast@@QAEAAV0@ABV0@@Z
27−??4bad_typeid@@QAEAAV0@ABV0@@Z
28−??4exception@@QAEAAV0@ABV0@@Z
29−??8type_info@@QBEHABV0@@Z
30−??9type_info@@QBEHABV0@@Z
9+??0bad_cast@@QEAA@AEBQEBD@Z
10+??0bad_cast@@QEAA@AEBV0@@Z
11+??0bad_cast@@QEAA@PEBD@Z
12+??0bad_typeid@@QEAA@AEBV0@@Z
13+??0bad_typeid@@QEAA@PEBD@Z
14+??0exception@@QEAA@AEBQEBD@Z
15+??0exception@@QEAA@AEBQEBDH@Z
16+??0exception@@QEAA@AEBV0@@Z
17+??0exception@@QEAA@XZ
18+??1__non_rtti_object@@UEAA@XZ
19+??1bad_cast@@UEAA@XZ
20+??1bad_typeid@@UEAA@XZ
21+??1exception@@UEAA@XZ
22+??1type_info@@UEAA@XZ
23+??2@YAPEAX_K@Z
24+??2@YAPEAX_KHPEBDH@Z
25+??3@YAXPEAX@Z
26+??4__non_rtti_object@@QEAAAEAV0@AEBV0@@Z
27+??4bad_cast@@QEAAAEAV0@AEBV0@@Z
28+??4bad_typeid@@QEAAAEAV0@AEBV0@@Z
29+??4exception@@QEAAAEAV0@AEBV0@@Z
30+??8type_info@@QEBAHAEBV0@@Z
31+??9type_info@@QEBAHAEBV0@@Z
3132 ??_7__non_rtti_object@@6B@
3233 ??_7bad_cast@@6B@
3334 ??_7bad_typeid@@6B@
3435 ??_7exception@@6B@
35−??_E__non_rtti_object@@UAEPAXI@Z
36−??_Ebad_cast@@UAEPAXI@Z
37−??_Ebad_typeid@@UAEPAXI@Z
38−??_Eexception@@UAEPAXI@Z
39−??_Fbad_cast@@QAEXXZ
40−??_Fbad_typeid@@QAEXXZ
41−??_G__non_rtti_object@@UAEPAXI@Z
42−??_Gbad_cast@@UAEPAXI@Z
43−??_Gbad_typeid@@UAEPAXI@Z
44−??_Gexception@@UAEPAXI@Z
45−??_U@YAPAXI@Z
46−??_U@YAPAXIHPBDH@Z
47−??_V@YAXPAX@Z
48−?_query_new_handler@@YAP6AHI@ZXZ
36+??_Fbad_cast@@QEAAXXZ
37+??_Fbad_typeid@@QEAAXXZ
38+??_U@YAPEAX_K@Z
39+??_U@YAPEAX_KHPEBDH@Z
40+??_V@YAXPEAX@Z
41+?_query_new_handler@@YAP6AH_K@ZXZ
4942 ?_query_new_mode@@YAHXZ
50−?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z
43+?_set_new_handler@@YAP6AH_K@ZP6AH0@Z@Z
5144 ?_set_new_mode@@YAHH@Z
52−?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z
53−?before@type_info@@QBEHABV1@@Z
54−?name@type_info@@QBEPBDXZ
55−?raw_name@type_info@@QBEPBDXZ
45+?_set_se_translator@@YAP6AXIPEAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z
46+?before@type_info@@QEBAHAEBV1@@Z
47+?name@type_info@@QEBAPEBDXZ
48+?raw_name@type_info@@QEBAPEBDXZ
5649 ?set_new_handler@@YAP6AXXZP6AXXZ@Z
5750 ?set_terminate@@YAP6AXXZP6AXXZ@Z
5851 ?set_unexpected@@YAP6AXXZP6AXXZ@Z
5952 ?terminate@@YAXXZ
6053 ?unexpected@@YAXXZ
61−?what@exception@@UBEPBDXZ
62−_CIacos
63−_CIasin
64−_CIatan
65−_CIatan2
66−_CIcos
67−_CIcosh
68−_CIexp
69−_CIfmod
70−_CIlog
71−_CIlog10
72−_CIpow
73−_CIsin
74−_CIsinh
75−_CIsqrt
76−_CItan
77−_CItanh
54+?what@exception@@UEBAPEBDXZ
7855 _CrtCheckMemory
7956 _CrtDbgBreak
8057 _CrtDbgReport
@@ -101,27 +78,33 @@ _CrtSetReportHook · 20 unmodified lines
10178 _CrtSetReportHook2
10279 _CrtSetReportMode
10380 _CxxThrowException
104−_EH_prolog
10581 _Getdays
10682 _Getmonths
10783 _Gettnames
10884 _HUGE
10985 _Strftime
86+_W_Getdays
87+_W_Getmonths
88+_W_Gettnames
89+_Wcsftime
11090 _XcptFilter
91+__AdjustPointer
92+__C_specific_handler
11193 __CppXcptFilter
112−__CxxCallUnwindDelDtor
113−__CxxCallUnwindDtor
114−__CxxCallUnwindVecDtor
115−__CxxDetectRethrow
116−__CxxExceptionFilter
11794 __CxxFrameHandler
11895 __CxxFrameHandler2
11996 __CxxFrameHandler3
120−__CxxLongjmpUnwind
121−__CxxQueryExceptionSize
122−__CxxRegisterExceptionObject
123−__CxxUnregisterExceptionObject
12497 __DestructExceptionObject
98+__ExceptionPtrAssign
99+__ExceptionPtrCompare
100+__ExceptionPtrCopy
101+__ExceptionPtrCopyException
102+__ExceptionPtrCreate
103+__ExceptionPtrCurrentException
104+__ExceptionPtrDestroy
105+__ExceptionPtrRethrow
106+__ExceptionPtrSwap
107+__ExceptionPtrToBool
125108 __RTCastToVoid
126109 __RTDynamicCast
127110 __RTtypeid
@@ -156,57 +139,7 @@ __lc_codepage · 28 unmodified lines
156139 __lc_collate_cp
157140 __lc_handle
158141 __lconv_init
159−__libm_sse2_acos
160−__libm_sse2_acosf
161−__libm_sse2_asin
162−__libm_sse2_asinf
163−__libm_sse2_atan
164−__libm_sse2_atan2
165−__libm_sse2_atanf
166−__libm_sse2_cos
167−__libm_sse2_cosf
168−__libm_sse2_exp
169−__libm_sse2_expf
170−__libm_sse2_log
171−__libm_sse2_log10
172−__libm_sse2_log10f
173−__libm_sse2_logf
174−__libm_sse2_pow
175−__libm_sse2_powf
176−__libm_sse2_sin
177−__libm_sse2_sinf
178−__libm_sse2_tan
179−__libm_sse2_tanf
180142 __mb_cur_max
181−__p___argc
182−__p___argv
183−__p___initenv
184−__p___mb_cur_max
185−__p___wargv
186−__p___winitenv
187−__p__acmdln
188−__p__amblksiz
189−__p__commode
190−__p__daylight
191−__p__dstbias
192−__p__environ
193−__p__fileinfo
194−__p__fmode
195−__p__iob
196−__p__mbcasemap
197−__p__mbctype
198−__p__osver
199−__p__pctype
200−__p__pgmptr
201−__p__pwctype
202−__p__timezone
203−__p__tzname
204−__p__wcmdln
205−__p__wenviron
206−__p__winmajor
207−__p__winminor
208−__p__winver
209−__p__wpgmptr
210143 __pctype_func
211144 __pioinfo
212145 __pwctype_func
@@ -228,25 +161,10 @@ __wcserror_s · 15 unmodified lines
228161 __wcsncnt
229162 __wgetmainargs
230163 __winitenv
231−_abnormal_termination
232164 _abs64
233165 _access
234166 _access_s
235167 _acmdln
236−_adj_fdiv_m16i
237−_adj_fdiv_m32
238−_adj_fdiv_m32i
239−_adj_fdiv_m64
240−_adj_fdiv_r
241−_adj_fdivr_m16i
242−_adj_fdivr_m32
243−_adj_fdivr_m32i
244−_adj_fdivr_m64
245−_adj_fpatan
246−_adj_fprem
247−_adj_fprem1
248−_adj_fptan
249−_adjust_fdiv
250168 _aexit_rtn
251169 _aligned_free
252170 _aligned_free_dbg
@@ -285,7 +203,7 @@ _cgetws_s · 32 unmodified lines
285203 _chdir
286204 _chdrive
287205 _chgsign
288−_chkesp
206+_chgsignf
289207 _chmod
290208 _chsize
291209 _chsize_s
@@ -299,6 +217,7 @@ _control87 · 7 unmodified lines
299217 _controlfp
300218 _controlfp_s
301219 _copysign
220+_copysignf
302221 _cprintf
303222 _cprintf_l
304223 _cprintf_p
@@ -308,6 +227,7 @@ _cprintf_s_l · 3 unmodified lines
308227 _cputs
309228 _cputws
310229 _creat
230+_create_locale
311231 _crtAssertBusy
312232 _crtBreakAlloc
313233 _crtDbgFlag
@@ -344,9 +264,6 @@ _endthreadex · 30 unmodified lines
344264 _environ
345265 _eof
346266 _errno
347−_except_handler2
348−_except_handler3
349−_except_handler4_common
350267 _execl
351268 _execle
352269 _execlp
@@ -377,11 +294,12 @@ _findnext · 24 unmodified lines
377294 _findnext64
378295 _findnexti64
379296 _finite
297+_finitef
380298 _flsbuf
381299 _flushall
382300 _fmode
383301 _fpclass
384−_fpieee_flt
302+_fpclassf
385303 _fpreset
386304 _fprintf_l
387305 _fprintf_p
@@ -390,6 +308,7 @@ _fprintf_s_l · 2 unmodified lines
390308 _fputchar
391309 _fputwchar
392310 _free_dbg
311+_free_locale
393312 _freea
394313 _freea_s
395314 _fscanf_l
@@ -404,10 +323,6 @@ _ftime32 · 8 unmodified lines
404323 _ftime32_s
405324 _ftime64
406325 _ftime64_s
407−_ftol
408−_ftol2
409−_ftol2_sse
410−_ftol2_sse_excpt
411326 _fullpath
412327 _fullpath_dbg
413328 _futime
@@ -421,6 +336,7 @@ _fwscanf_l · 7 unmodified lines
421336 _fwscanf_s_l
422337 _gcvt
423338 _gcvt_s
339+_get_current_locale
424340 _get_doserrno
425341 _get_environ
426342 _get_errno
@@ -443,7 +359,6 @@ _getche · 16 unmodified lines
443359 _getcwd
444360 _getdcwd
445361 _getdiskfree
446−_getdllprocaddr
447362 _getdrive
448363 _getdrives
449364 _getmaxstdio
@@ -454,27 +369,22 @@ _getw · 4 unmodified lines
454369 _getwch
455370 _getwche
456371 _getws
457−_global_unwind2
458372 _gmtime32
459373 _gmtime32_s
460374 _gmtime64
461375 _gmtime64_s
462−_heapadd
463376 _heapchk
464377 _heapmin
465378 _heapset
466−_heapused
467379 _heapwalk
468380 _hypot
381+_hypotf
469382 _i64toa
470383 _i64toa_s
471384 _i64tow
472385 _i64tow_s
473386 _initterm
474387 _initterm_e
475−_inp
476−_inpd
477−_inpw
478388 _invalid_parameter
479389 _iob
480390 _isalnum_l
@@ -546,6 +456,7 @@ _ismbslead_l · 65 unmodified lines
546456 _ismbstrail
547457 _ismbstrail_l
548458 _isnan
459+_isnanf
549460 _isprint_l
550461 _isspace_l
551462 _isupper_l
@@ -572,9 +483,7 @@ _jn · 20 unmodified lines
572483 _kbhit
573484 _lfind
574485 _lfind_s
575−_loaddll
576−_local_unwind2
577−_local_unwind4
486+_local_unwind
578487 _localtime32
579488 _localtime32_s
580489 _localtime64
@@ -582,7 +491,7 @@ _localtime64_s · 1 unmodified line
582491 _lock
583492 _locking
584493 _logb
585−_longjmpex
494+_logbf
586495 _lrotl
587496 _lrotr
588497 _lsearch
@@ -746,16 +655,14 @@ _mktemp_s · 157 unmodified lines
746655 _mktime32
747656 _mktime64
748657 _msize
749−_msize_debug
658+_msize_dbg
750659 _nextafter
660+_nextafterf
751661 _onexit
752662 _open
753663 _open_osfhandle
754664 _osplatform
755665 _osver
756−_outp
757−_outpd
758−_outpw
759666 _pclose
760667 _pctype
761668 _pgmptr
@@ -782,11 +689,8 @@ _rotl · 20 unmodified lines
782689 _rotl64
783690 _rotr
784691 _rotr64
785−_safe_fdiv
786−_safe_fdivr
787−_safe_fprem
788−_safe_fprem1
789692 _scalb
693+_scalbf
790694 _scanf_l
791695 _scanf_s_l
792696 _scprintf
@@ -797,9 +701,6 @@ _scwprintf_l · 4 unmodified lines
797701 _scwprintf_p_l
798702 _searchenv
799703 _searchenv_s
800−_seh_longjmp_unwind
801−_seh_longjmp_unwind4
802−_set_SSE2_enable
803704 _set_controlfp
804705 _set_doserrno
805706 _set_errno
@@ -810,7 +711,7 @@ _set_output_format · 4 unmodified lines
810711 _set_sbh_threshold
811712 _seterrormode
812713 _setjmp
813−_setjmp3
714+_setjmpex
814715 _setmaxstdio
815716 _setmbcp
816717 _setmode
@@ -934,7 +835,6 @@ _umask_s · 117 unmodified lines
934835 _ungetch
935836 _ungetwch
936837 _unlink
937−_unloaddll
938838 _unlock
939839 _utime
940840 _utime32
@@ -1027,6 +927,7 @@ _wcsnset_s · 86 unmodified lines
1027927 _wcsrev
1028928 _wcsset
1029929 _wcsset_s
930+_wcstod_l
1030931 _wcstoi64
1031932 _wcstoi64_l
1032933 _wcstol_l
@@ -1146,11 +1047,15 @@ _yn · 113 unmodified lines
11461047 abort
11471048 abs
11481049 acos
1050+acosf
11491051 asctime
11501052 asctime_s
11511053 asin
1054+asinf
11521055 atan
11531056 atan2
1057+atan2f
1058+atanf
11541059 atexit
11551060 atof
11561061 atoi
@@ -1160,16 +1065,20 @@ bsearch_s · 3 unmodified lines
11601065 btowc
11611066 calloc
11621067 ceil
1068+ceilf
11631069 clearerr
11641070 clearerr_s
11651071 clock
11661072 cos
1073+cosf
11671074 cosh
1075+coshf
11681076 ctime
11691077 difftime
11701078 div
11711079 exit
11721080 exp
1081+expf
11731082 fabs
11741083 fclose
11751084 feof
@@ -1181,7 +1090,9 @@ fgets · 5 unmodified lines
11811090 fgetwc
11821091 fgetws
11831092 floor
1093+floorf
11841094 fmod
1095+fmodf
11851096 fopen
11861097 fopen_s
11871098 fprintf
@@ -1246,6 +1157,8 @@ localeconv · 58 unmodified lines
12461157 localtime
12471158 log
12481159 log10
1160+log10f
1161+logf
12491162 longjmp
12501163 malloc
12511164 mblen
@@ -1266,8 +1179,10 @@ memmove_s · 14 unmodified lines
12661179 memset
12671180 mktime
12681181 modf
1182+modff
12691183 perror
12701184 pow
1185+powf
12711186 printf
12721187 printf_s
12731188 putc
@@ -1287,14 +1202,18 @@ rewind · 13 unmodified lines
12871202 scanf
12881203 scanf_s
12891204 setbuf
1205+setjmp
12901206 setlocale
12911207 setvbuf
12921208 signal
12931209 sin
1210+sinf
12941211 sinh
1212+sinhf
12951213 sprintf
12961214 sprintf_s
12971215 sqrt
1216+sqrtf
12981217 srand
12991218 sscanf
13001219 sscanf_s
@@ -1332,7 +1251,9 @@ swscanf · 31 unmodified lines
13321251 swscanf_s
13331252 system
13341253 tan
1254+tanf
13351255 tanh
1256+tanhf
13361257 time
13371258 tmpfile
13381259 tmpfile_s

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t