diff --git a/lib/libc/mingw/lib-common/msvcrt.def.in b/lib/libc/mingw/lib-common/msvcrt.def.in deleted file mode 100644 index 1f8f95b1750e..000000000000 --- a/lib/libc/mingw/lib-common/msvcrt.def.in +++ /dev/null @@ -1,1628 +0,0 @@ -LIBRARY "msvcrt.dll" -EXPORTS - -#include "func.def.in" -#include "msvcrt-common.def.in" - -#ifdef DEF_I386 -_CIacos -_CIasin -_CIatan -_CIatan2 -_CIcos -_CIcosh -_CIexp -_CIfmod -_CIlog -_CIlog10 -_CIpow -_CIsin -_CIsinh -_CIsqrt -_CItan -_CItanh -#endif - -#ifdef DEF_X64 -$I10_OUTPUT -; public: __cdecl __non_rtti_object::__non_rtti_object(class __non_rtti_object const & __ptr64) __ptr64 -; GCC = __ZN17__non_rtti_objectC2ERKS_ -??0__non_rtti_object@@QEAA@AEBV0@@Z -; public: __cdecl __non_rtti_object::__non_rtti_object(char const * __ptr64) __ptr64 -; GCC = __ZN17__non_rtti_objectC1ERKS_ -??0__non_rtti_object@@QEAA@PEBD@Z -; private: __cdecl bad_cast::bad_cast(char const * __ptr64 const * __ptr64) __ptr64 -??0bad_cast@@AEAA@PEBQEBD@Z -; public: __cdecl bad_cast::bad_cast(char const * __ptr64 const & __ptr64) __ptr64 -??0bad_cast@@QEAA@AEBQEBD@Z -; public: __cdecl bad_cast::bad_cast(class bad_cast const & __ptr64) __ptr64 -??0bad_cast@@QEAA@AEBV0@@Z -; public: __cdecl bad_cast::bad_cast(char const * __ptr64) __ptr64 -??0bad_cast@@QEAA@PEBD@Z -; public: __cdecl bad_typeid::bad_typeid(class bad_typeid const & __ptr64) __ptr64 -??0bad_typeid@@QEAA@AEBV0@@Z -; public: __cdecl bad_typeid::bad_typeid(char const * __ptr64) __ptr64 -??0bad_typeid@@QEAA@PEBD@Z -; public: __cdecl exception::exception(char const * __ptr64 const & __ptr64) __ptr64 -??0exception@@QEAA@AEBQEBD@Z -; public: __cdecl exception::exception(char const * __ptr64 const & __ptr64,int) __ptr64 -??0exception@@QEAA@AEBQEBDH@Z -; public: __cdecl exception::exception(class exception const & __ptr64) __ptr64 -??0exception@@QEAA@AEBV0@@Z -; public: __cdecl exception::exception(void) __ptr64 -??0exception@@QEAA@XZ -; public: virtual __cdecl __non_rtti_object::~__non_rtti_object(void) __ptr64 -??1__non_rtti_object@@UEAA@XZ -; public: virtual __cdecl bad_cast::~bad_cast(void) __ptr64 -??1bad_cast@@UEAA@XZ -; public: virtual __cdecl bad_typeid::~bad_typeid(void) __ptr64 -??1bad_typeid@@UEAA@XZ -; public: virtual __cdecl exception::~exception(void) __ptr64 -??1exception@@UEAA@XZ -; public: virtual __cdecl type_info::~type_info(void) __ptr64 -??1type_info@@UEAA@XZ -; void * __ptr64 __cdecl operator new(unsigned __int64) -; GCC = __Znwy -??2@YAPEAX_K@Z -; void __cdecl operator delete(void * __ptr64) -; GCC = __ZdlPv -??3@YAXPEAX@Z -; public: class __non_rtti_object & __ptr64 __cdecl __non_rtti_object::operator=(class __non_rtti_object const & __ptr64) __ptr64 -??4__non_rtti_object@@QEAAAEAV0@AEBV0@@Z -; public: class bad_cast & __ptr64 __cdecl bad_cast::operator=(class bad_cast const & __ptr64) __ptr64 -??4bad_cast@@QEAAAEAV0@AEBV0@@Z -; public: class bad_typeid & __ptr64 __cdecl bad_typeid::operator=(class bad_typeid const & __ptr64) __ptr64 -??4bad_typeid@@QEAAAEAV0@AEBV0@@Z -; public: class exception & __ptr64 __cdecl exception::operator=(class exception const & __ptr64) __ptr64 -??4exception@@QEAAAEAV0@AEBV0@@Z -; public: int __cdecl type_info::operator==(class type_info const & __ptr64)const __ptr64 -??8type_info@@QEBAHAEBV0@@Z -; public: int __cdecl type_info::operator!=(class type_info const & __ptr64)const __ptr64 -??9type_info@@QEBAHAEBV0@@Z -; const __non_rtti_object::`vftable' -??_7__non_rtti_object@@6B@ -; const bad_cast::`vftable' -??_7bad_cast@@6B@ -; const bad_typeid::`vftable' -??_7bad_typeid@@6B@ -; const exception::`vftable' -??_7exception@@6B@ -; public: void __cdecl bad_cast::`default constructor closure'(void) __ptr64 -??_Fbad_cast@@QEAAXXZ -; public: void __cdecl bad_typeid::`default constructor closure'(void) __ptr64 -??_Fbad_typeid@@QEAAXXZ -; void * __ptr64 __cdecl operator new[](unsigned __int64) -; GNU = __Znay -??_U@YAPEAX_K@Z -; void __cdecl operator delete[](void * __ptr64) -; GNU = __ZdaPv -??_V@YAXPEAX@Z -; int (__cdecl*__cdecl _query_new_handler(void))(unsigned __int64) -; GNU = __Z18_query_new_handlerv -?_query_new_handler@@YAP6AH_K@ZXZ -; int __cdecl _query_new_mode(void) -; GNU = __Z15_query_new_modev -?_query_new_mode@@YAHXZ -; int (__cdecl*__cdecl _set_new_handler(int (__cdecl*)(unsigned __int64)))(unsigned __int64) -; GNU = __Z16_set_new_handlerPFiyE -?_set_new_handler@@YAP6AH_K@ZP6AH0@Z@Z -; int __cdecl _set_new_mode(int) -; GNU = __Z13_set_new_modei -?_set_new_mode@@YAHH@Z -; void (__cdecl*__cdecl _set_se_translator(void (__cdecl*)(unsigned int,struct _EXCEPTION_POINTERS * __ptr64)))(unsigned int,struct _EXCEPTION_POINTERS * __ptr64) -; GNU = __Z18_set_se_translatorPFvjP19_EXCEPTION_POINTERSE -?_set_se_translator@@YAP6AXIPEAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z -; public: int __cdecl type_info::before(class type_info const & __ptr64)const __ptr64 -?before@type_info@@QEBAHAEBV1@@Z -; public: char const * __ptr64 __cdecl type_info::name(void)const __ptr64 -?name@type_info@@QEBAPEBDXZ -; public: char const * __ptr64 __cdecl type_info::raw_name(void)const __ptr64 -?raw_name@type_info@@QEBAPEBDXZ -; void (__cdecl*__cdecl set_new_handler(void (__cdecl*)(void)))(void) -; GNU = __Z15set_new_handlerPFvvE -?set_new_handler@@YAP6AXXZP6AXXZ@Z -; void (__cdecl*__cdecl set_terminate(void (__cdecl*)(void)))(void) -; GNU = __Z13set_terminatePFvvE -?set_terminate@@YAP6AXXZP6AXXZ@Z -; void (__cdecl*__cdecl set_unexpected(void (__cdecl*)(void)))(void) -; GNU = __Z14set_unexpectedPFvvE -?set_unexpected@@YAP6AXXZP6AXXZ@Z -; void __cdecl terminate(void) -; GNU = __Z9terminatev -?terminate@@YAXXZ -; void __cdecl unexpected(void) -; GNU = __Z10unexpectedv -?unexpected@@YAXXZ -; public: virtual char const * __ptr64 __cdecl exception::what(void)const __ptr64 -?what@exception@@UEBAPEBDXZ -#endif - -#ifdef DEF_ARM32 -??0__non_rtti_object@@QAA@ABV0@@Z -??0__non_rtti_object@@QAA@PBD@Z -??0bad_cast@@AAA@PBQBD@Z -??0bad_cast@@QAA@ABV0@@Z -??0bad_cast@@QAA@PBD@Z -??0bad_typeid@@QAA@ABV0@@Z -??0bad_typeid@@QAA@PBD@Z -??0exception@@QAA@ABQBD@Z -??0exception@@QAA@ABQBDH@Z -??0exception@@QAA@ABV0@@Z -??0exception@@QAA@XZ -??1__non_rtti_object@@UAA@XZ -??1bad_cast@@UAA@XZ -??1bad_typeid@@UAA@XZ -??1exception@@UAA@XZ -??1type_info@@UAA@XZ -??2@YAPAXI@Z -??2@YAPAXIHPBDH@Z -??3@YAXPAX@Z -??4__non_rtti_object@@QAAAAV0@ABV0@@Z -??4bad_cast@@QAAAAV0@ABV0@@Z -??4bad_typeid@@QAAAAV0@ABV0@@Z -??4exception@@QAAAAV0@ABV0@@Z -??8type_info@@QBAHABV0@@Z -??9type_info@@QBAHABV0@@Z -??_7__non_rtti_object@@6B@ DATA -??_7bad_cast@@6B@ DATA -??_7bad_typeid@@6B@ DATA -??_7exception@@6B@ DATA -??_Fbad_cast@@QAAXXZ -??_Fbad_typeid@@QAAXXZ -??_U@YAPAXI@Z -??_U@YAPAXIHPBDH@Z -??_V@YAXPAX@Z -_CallMemberFunction0 -_CallMemberFunction1 -_CallMemberFunction2 -__ExceptionPtrAssign -__ExceptionPtrCompare -__ExceptionPtrCopy -__ExceptionPtrCopyException -__ExceptionPtrCreate -__ExceptionPtrCurrentException -__ExceptionPtrDestroy -__ExceptionPtrRethrow -__ExceptionPtrSwap -__ExceptionPtrToBool -?_query_new_handler@@YAP6AHI@ZXZ -?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z -?_set_new_mode@@YAHH@Z -?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z -?before@type_info@@QBAHABV1@@Z -?name@type_info@@QBAPBDXZ -?raw_name@type_info@@QBAPBDXZ -?set_terminate@@YAP6AXXZP6AXXZ@Z -?set_unexpected@@YAP6AXXZP6AXXZ@Z -?terminate@@YAXXZ -?unexpected@@YAXXZ -?what@exception@@UBAPBDXZ -#endif - -#ifdef DEF_ARM32 -_CrtCheckMemory -_CrtDbgBreak -_CrtDbgReport -_CrtDbgReportV -_CrtDbgReportW -_CrtDbgReportWV -_CrtDoForAllClientObjects -_CrtDumpMemoryLeaks -_CrtIsMemoryBlock -_CrtIsValidHeapPointer -_CrtIsValidPointer -_CrtMemCheckpoint -_CrtMemDifference -_CrtMemDumpAllObjectsSince -_CrtMemDumpStatistics -_CrtReportBlockType -_CrtSetAllocHook -_CrtSetBreakAlloc -_CrtSetDbgBlockType -_CrtSetDbgFlag -_CrtSetDumpClient -_CrtSetReportFile -_CrtSetReportHook -_CrtSetReportHook2 -_CrtSetReportMode -#endif -F_I386(_CxxThrowException@8) -F_NON_I386(_CxxThrowException) -F_I386(_EH_prolog) -_Getdays -_Getmonths -_Gettnames -_HUGE DATA -_Strftime -F_ARM_ANY(_W_Getdays) -F_ARM_ANY(_W_Getmonths) -F_ARM_ANY(_W_Gettnames) -F_ARM_ANY(_Wcsftime) -_XcptFilter -F_ARM_ANY(__AdjustPointer) -F_NON_I386(__C_specific_handler) -__CppXcptFilter -F_I386(__CxxCallUnwindDtor) -F_I386(__CxxCallUnwindVecDtor) -F_I386(__CxxDetectRethrow) -F_I386(__CxxExceptionFilter) -F_X86_ANY(__CxxFrameHandler) -F_ARM_ANY(__CxxFrameHandler3) -F_I386(__CxxLongjmpUnwind) -F_I386(__CxxQueryExceptionSize) -F_I386(__CxxRegisterExceptionObject) -F_I386(__CxxUnregisterExceptionObject) -__DestructExceptionObject -__RTCastToVoid -__RTDynamicCast -__RTtypeid -__STRINGTOLD -F_NON_I386(___lc_codepage_func) -___lc_collate_cp_func -___lc_handle_func -; ___mb_cur_max_func exists (on all archs) since XP. Earlier, this function -; was never used, but the __mb_cur_max data symbol was accessed instead. -; For i386 we provide this function as a statically linked helper, that uses -; __mb_cur_max, to avoid forcing a dependency on XP here. -F_NON_I386(___mb_cur_max_func) -F_X86_ANY(___setlc_active_func) -F_X86_ANY(___unguarded_readlc_active_add_func) -__argc DATA -__argv DATA -__badioinfo DATA -F_I386(__buffer_overrun) -__crtCompareStringA -__crtCompareStringW -__crtGetLocaleInfoW -__crtGetStringTypeW -__crtLCMapStringA -__crtLCMapStringW -F_ARM_ANY(__daylight) -__dllonexit -__doserrno -F_ARM_ANY(__dstbias) -__fpecode -__getmainargs -F_X86_ANY(__initenv DATA) -__iob_func -__isascii -__iscsym -__iscsymf -F_I386(__lc_clike) -F_X86_ANY(__lc_codepage DATA) -F_X86_ANY(__lc_collate_cp DATA) -__lc_handle DATA -__lconv_init -__mb_cur_max DATA -#ifdef DEF_I386 -__p___argc -__p___argv -__p___initenv -__p___mb_cur_max -__p___wargv -__p___winitenv -__p__acmdln -__p__amblksiz -__p__commode -__p__daylight -__p__dstbias -__p__environ -__p__fileinfo -__p__fmode -__p__iob -__p__mbcasemap -__p__mbctype -__p__osver -__p__pctype -__p__pgmptr -__p__pwctype -__p__timezone -__p__tzname -__p__wcmdln -__p__wenviron -__p__winmajor -__p__winminor -__p__winver -__p__wpgmptr -#endif -__pctype_func -__pioinfo DATA -__pwctype_func -__pxcptinfoptrs -F_I386(__security_error_handler) -__set_app_type -F_I386(__set_buffer_overrun_handler) -F_X86_ANY(__setlc_active DATA) -__setusermatherr -F_ARM_ANY(__strncnt) -F_X86_ANY(__threadhandle) -F_X86_ANY(__threadid) -__toascii -__uncaught_exception -__unDName -__unDNameEx -F_X86_ANY(__unguarded_readlc_active DATA) -__wargv DATA -__wcserror -F_NON_I386(__wcserror_s) -F_ARM_ANY(__wcsncnt) -__wgetmainargs -F_X86_ANY(__winitenv DATA) -F_I386(_abnormal_termination) -F_NON_I386(_abs64) -F_NON_I386(llabs == _abs64) -F_NON_I386(imaxabs == _abs64) -_access -; _access_s Replaced by emu -_acmdln DATA -#ifdef DEF_I386 -_adj_fdiv_m16i -_adj_fdiv_m32 -_adj_fdiv_m32i -_adj_fdiv_m64 -_adj_fdiv_r -_adj_fdivr_m16i -_adj_fdivr_m32 -_adj_fdivr_m32i -_adj_fdivr_m64 -_adj_fpatan -_adj_fprem -_adj_fprem1 -_adj_fptan -_adjust_fdiv DATA -#endif -_aexit_rtn DATA -_aligned_free -F_ARM_ANY(_aligned_free_dbg) -_aligned_malloc -F_ARM_ANY(_aligned_malloc_dbg) -_aligned_offset_malloc -F_ARM_ANY(_aligned_offset_malloc_dbg) -_aligned_offset_realloc -F_ARM_ANY(_aligned_offset_realloc_dbg) -_aligned_realloc -F_ARM_ANY(_aligned_realloc_dbg) -_amsg_exit -_assert -_atodbl -_atodbl_l -_atof_l -_atoflt_l -_atoi64 -atoll == _atoi64 -_atoi64_l -_atoll_l == _atoi64_l -_atoi_l -_atol_l -_atoldbl -F_NON_I386(_atoldbl_l) -F_X86_ANY(_beep) -_beginthread -_beginthreadex -_c_exit -_cabs DATA -_callnewh -F_ARM_ANY(_calloc_dbg) -_cexit -_cgets -; _cgets_s replaced by emu -_cgetws -; _cgetws_s replaced by emu -_chdir -_chdrive -_chgsign -F_NON_I386(_chgsignf) -_chmod -F_I386(_chkesp) -_chsize -; _chsize_s replaced by emu -F_ARM_ANY(_chvalidator) -F_ARM_ANY(_chvalidator_l) -_clearfp -_close -_commit -_commode DATA -_control87 -_controlfp -; _controlfp_s replaced by emu -_copysign -F_NON_I386(_copysignf) -_cprintf -_cprintf_l -_cprintf_p -_cprintf_p_l -; _cprintf_s Replaced by emu -; _cprintf_s_l likewise. -_cputs -_cputws -F_I386(_CRT_RTC_INIT) -_creat -F_ARM_ANY(_create_locale) -F_ARM32(_crtAssertBusy) -F_ARM32(_crtBreakAlloc) -F_ARM32(_crtDbgFlag) -_cscanf -_cscanf_l -_cscanf_s -_cscanf_s_l -F_ARM_ANY(_ctime32) -F_I386(_ctime32 == ctime) -; _ctime32_s replaced by emu -_ctime64 -; _ctime64_s replaced by emu -_ctype F_I386(DATA) -_cwait -_cwprintf -_cwprintf_l -_cwprintf_p -_cwprintf_p_l -; _cwprintf_s Replaced by emu -; _cwprintf_s_l Likewise. -_cwscanf -_cwscanf_l -_cwscanf_s -_cwscanf_s_l -F_X86_ANY(_dstbias DATA) -_daylight DATA -_difftime32 F_I386(== difftime) -_difftime64 -_dup -_dup2 -_ecvt -_ecvt_s -_endthread -_endthreadex -F_X86_ANY(_environ DATA) -_eof -_errno -F_I386(_except_handler2) -F_I386(_except_handler3) -_execl -_execle -_execlp -_execlpe -_execv -_execve -_execvp -_execvpe -_exit -_expand -F_ARM_ANY(_expand_dbg) -_fcloseall -_fcvt -_fcvt_s -_fdopen -_fgetchar -_fgetwchar -_filbuf -F_X86_ANY(_fileinfo DATA) -_filelength -_filelengthi64 -_fileno -_findclose -_findfirst -F32(_findfirst32 == _findfirst) -_findfirst64 -_findfirsti64 -F32(_findfirst32i64 == _findfirsti64) -F64(_findfirst64i32 == _findfirst) -_findnext -F32(_findnext32 == _findnext) -_findnext64 -_findnexti64 -F32(_findnext32i64 == _findnexti64) -F64(_findnext64i32 == _findnext) -_finite -F_NON_I386(_finitef) -_flsbuf -_flushall -_fmode DATA -_fpclass -F_X64(_fpclassf) -F_I386(_fpieee_flt) -F_ARM_ANY(_fpieee_flt) -_fpreset DATA -_fprintf_l -_fprintf_p -_fprintf_p_l -_fprintf_s_l -_fputchar -_fputwchar -F_ARM_ANY(_free_dbg) -F_ARM_ANY(_free_locale) -F_ARM_ANY(_freea) -F_NON_I386(_fscanf_l) -F_NON_I386(_fscanf_s_l) -F_ARM_ANY(_fseeki64) -_fsopen -_fstat -F32(_fstat32 == _fstat) -_fstat64 -_fstati64 -F64(_fstat64i32 == _fstat) -_ftime -F_I386(_ftime32 == _ftime) -F_NON_I386(_ftime32) -_ftime32_s -_ftime64 -_ftime64_s -F32(_ftime_s == _ftime32_s) -F64(_ftime_s == _ftime64_s) -F_I386(_ftol) -_fullpath -F_ARM_ANY(_fullpath_dbg) -_futime -F_I386(_futime32 == _futime) -F_NON_I386(_futime32) -_futime64 -_fwprintf_l -_fwprintf_p -_fwprintf_p_l -_fwprintf_s_l -_fwscanf_l -_fwscanf_s_l -_gcvt -_gcvt_s -F_ARM_ANY(_get_current_locale) -_get_doserrno -F_ARM_ANY(_get_environ) -F_ARM_ANY(_get_errno) -F_ARM_ANY(_get_fileinfo) -F_ARM_ANY(_get_fmode) -F_X86_ANY(_get_heap_handle) -_get_osfhandle -;_get_output_format provided by emu -F_X86_ANY(_get_sbh_threshold) -F_ARM_ANY(_get_wenviron) -_getch -_getche -_getcwd -_getdcwd -_getdiskfree -_getdllprocaddr -_getdrive -F_X86_ANY(_getdrives) -_getmaxstdio -_getmbcp -F_X86_ANY(_getpid) -F_X86_ANY(_getsystime) -_getw -_getwch -_getwche -F_X86_ANY(_getws) -F_I386(_global_unwind2) -_gmtime32 F_I386(== gmtime) -; _gmtime32_s replaced by emu -_gmtime64 -; _gmtime64_s replaced by emu -F_X86_ANY(_heapadd) -_heapchk -_heapmin -F_X86_ANY(_heapset) -F_X86_ANY(_heapused) -_heapwalk -_hypot -F_NON_I386(_hypotf) -_i64toa -_i64toa_s -_i64tow -_i64tow_s -_initterm -F_ARM_ANY(_initterm_e) -F_I386(_inp) -F_I386(_inpd) -F_I386(_inpw) -F_ARM_ANY(_invalid_parameter) -_iob DATA -_isalnum_l -_isalpha_l -_isatty -_iscntrl_l -_isctype -_isctype_l -_isdigit_l -_isgraph_l -_isleadbyte_l -_islower_l -_ismbbalnum -_ismbbalnum_l -_ismbbalpha -_ismbbalpha_l -_ismbbgraph -_ismbbgraph_l -_ismbbkalnum -_ismbbkalnum_l -_ismbbkana -_ismbbkana_l -_ismbbkprint -_ismbbkprint_l -_ismbbkpunct -_ismbbkpunct_l -_ismbblead -_ismbblead_l -_ismbbprint -_ismbbprint_l -_ismbbpunct -_ismbbpunct_l -_ismbbtrail -_ismbbtrail_l -_ismbcalnum -_ismbcalnum_l -_ismbcalpha -_ismbcalpha_l -_ismbcdigit -_ismbcdigit_l -_ismbcgraph -_ismbcgraph_l -_ismbchira -_ismbchira_l -_ismbckata -_ismbckata_l -_ismbcl0 -_ismbcl0_l -_ismbcl1 -_ismbcl1_l -_ismbcl2 -_ismbcl2_l -_ismbclegal -_ismbclegal_l -_ismbclower -_ismbclower_l -_ismbcprint -_ismbcprint_l -_ismbcpunct -_ismbcpunct_l -_ismbcspace -_ismbcspace_l -_ismbcsymbol -_ismbcsymbol_l -_ismbcupper -_ismbcupper_l -_ismbslead -_ismbslead_l -_ismbstrail -_ismbstrail_l -_isnan -F_X64(_isnanf) -_isprint_l -_isspace_l -_isupper_l -_iswalnum_l -_iswalpha_l -_iswcntrl_l -_iswctype_l -_iswdigit_l -_iswgraph_l -_iswlower_l -_iswprint_l -_iswpunct_l -_iswspace_l -_iswupper_l -_iswxdigit_l -_isxdigit_l -_itoa -_itoa_s -_itow -_itow_s -_j0 -_j1 -_jn -_kbhit -_lfind -F_X86_ANY(_loaddll) -F_NON_I386(_lfind_s) -F_X64(_local_unwind) -F_I386(_local_unwind2) -_localtime32 F_I386(== localtime) -; _localtime32_s replaced by emu -_localtime64 -; _localtime64_s replaced by emu -_lock -_locking -_logb -F_NON_I386(_logbf) -F_I386(_longjmpex) -_lrotl -_lrotr -_lsearch -F_NON_I386(_lsearch_s) -_lseek -_lseeki64 -_ltoa -F_NON_I386(_ltoa_s) -_ltow -F_NON_I386(_ltow_s) -_makepath -_makepath_s -F_ARM_ANY(_malloc_dbg) -_mbbtombc -_mbbtombc_l -_mbbtype -_mbcasemap F_NON_I386(DATA) -_mbccpy -_mbccpy_l -_mbccpy_s -_mbccpy_s_l -_mbcjistojms -_mbcjistojms_l -_mbcjmstojis -_mbcjmstojis_l -_mbclen -_mbclen_l -_mbctohira -_mbctohira_l -_mbctokata -_mbctokata_l -_mbctolower -_mbctolower_l -_mbctombb -_mbctombb_l -_mbctoupper -_mbctoupper_l -_mbctype DATA -_mblen_l -_mbsbtype -_mbsbtype_l -_mbscat -_mbscat_s -_mbscat_s_l -_mbschr -_mbschr_l -_mbscmp -_mbscmp_l -_mbscoll -_mbscoll_l -_mbscpy -_mbscpy_s -_mbscpy_s_l -_mbscspn -_mbscspn_l -_mbsdec -_mbsdec_l -_mbsdup -_mbsicmp -_mbsicmp_l -_mbsicoll -_mbsicoll_l -_mbsinc -_mbsinc_l -_mbslen -_mbslen_l -_mbslwr -_mbslwr_l -_mbslwr_s -_mbslwr_s_l -_mbsnbcat -_mbsnbcat_l -_mbsnbcat_s -_mbsnbcat_s_l -_mbsnbcmp -_mbsnbcmp_l -_mbsnbcnt -_mbsnbcnt_l -_mbsnbcoll -_mbsnbcoll_l -_mbsnbcpy -_mbsnbcpy_l -_mbsnbcpy_s -_mbsnbcpy_s_l -_mbsnbicmp -_mbsnbicmp_l -_mbsnbicoll -_mbsnbicoll_l -_mbsnbset -_mbsnbset_l -_mbsnbset_s -_mbsnbset_s_l -_mbsncat -_mbsncat_l -_mbsncat_s -_mbsncat_s_l -_mbsnccnt -_mbsnccnt_l -_mbsncmp -_mbsncmp_l -_mbsncoll -_mbsncoll_l -_mbsncpy -_mbsncpy_l -_mbsncpy_s -_mbsncpy_s_l -_mbsnextc -_mbsnextc_l -_mbsnicmp -_mbsnicmp_l -_mbsnicoll -_mbsnicoll_l -_mbsninc -_mbsninc_l -_mbsnlen -_mbsnlen_l -_mbsnset -_mbsnset_l -_mbsnset_s -_mbsnset_s_l -_mbspbrk -_mbspbrk_l -_mbsrchr -_mbsrchr_l -_mbsrev -_mbsrev_l -_mbsset -_mbsset_l -_mbsset_s -_mbsset_s_l -_mbsspn -_mbsspn_l -_mbsspnp -_mbsspnp_l -_mbsstr -_mbsstr_l -_mbstok -_mbstok_l -_mbstok_s -_mbstok_s_l -_mbstowcs_l -_mbstowcs_s_l -_mbstrlen -_mbstrlen_l -_mbstrnlen -_mbstrnlen_l -_mbsupr -_mbsupr_l -_mbsupr_s -_mbsupr_s_l -_mbtowc_l -_memccpy -F_ARM_ANY(_memcpy_strict_align) -_memicmp -_memicmp_l -_mkdir -_mkgmtime -_mkgmtime32 -_mkgmtime64 -_mktemp -; _mktemp_s replaced by emu -F_I386(_mktime32 == mktime) -F_ARM_ANY(_mktime32) -_mktime64 -_msize -F_ARM_ANY(_msize_dbg) -_nextafter -F_X64(_nextafterf) -_onexit -_open -_open_osfhandle -F_X86_ANY(_osplatform DATA) -_osver DATA -F_I386(_outp) -F_I386(_outpd) -F_I386(_outpw) -_pclose -_pctype DATA -_pgmptr DATA -_pipe -_popen -_printf_l -_printf_p -_printf_p_l -_printf_s_l -_purecall -_putch -_putenv -_putenv_s -_putw -_putwch -_putws -_pwctype DATA -_read -F_ARM_ANY(_realloc_dbg) -_resetstkoflw -_rmdir -_rmtmp -_rotl -F_NON_I386(_rotl64) -_rotr -F_NON_I386(_rotr64) -#ifdef DEF_I386 -_safe_fdiv -_safe_fdivr -_safe_fprem -_safe_fprem1 -#endif -_scalb -F_X64(_scalbf) -_scanf_l -_scanf_s_l -F_NON_I386(_scprintf) ; i386 _scprintf replaced by emu -_scprintf_l -_scprintf_p_l -_scwprintf -_scwprintf_l -_scwprintf_p_l -_searchenv -_searchenv_s -F_I386(_seh_longjmp_unwind) -_set_controlfp -_set_doserrno -F_ARM_ANY(_set_errno) -_set_error_mode -F_ARM_ANY(_set_fileinfo) -F_ARM_ANY(_set_fmode) -; Does not seem to present even on Win7 msvcrt -;_set_purecall_handler -F_X86_ANY(_set_sbh_threshold) -; _set_output_format provided by emu -F_I386(_set_SSE2_enable) -F_I386(_set_security_error_handler) -F_X86_ANY(_seterrormode) -_setjmp -F_I386(_setjmp3) -F_NON_I386(_setjmpex) -F_X86_ANY(_setmaxstdio) -_setmbcp -_setmode -F_X86_ANY(_setsystime) -F_X86_ANY(_sleep) -_snprintf -_snprintf_c -_snprintf_c_l -_snprintf_l -_snprintf_s -_snprintf_s_l -_snscanf -_snscanf_l -_snscanf_s -_snscanf_s_l -_snwprintf -snwprintf == _snwprintf -_snwprintf_l -_snwprintf_s -_snwprintf_s_l -_snwscanf -_snwscanf_l -_snwscanf_s -_snwscanf_s_l -_sopen -; _sopen_s replaced by emu -_spawnl -_spawnle -_spawnlp -_spawnlpe -_spawnv -_spawnve -_spawnvp -_spawnvpe -_splitpath -_splitpath_s -_sprintf_l -_sprintf_p_l -_sprintf_s_l -_sscanf_l -_sscanf_s_l -_stat -_stat64 -_stati64 -F32(_stat32 == _stat) -F64(_stat64i32 == _stat) -_statusfp -_strcmpi -_strcoll_l -_strdate -; _strdate_s replaced by emu -_strdup -F_ARM_ANY(_strdup_dbg) -_strerror -_strerror_s -_stricmp -_stricmp_l -_stricoll -_stricoll_l -_strlwr -strlwr == _strlwr -_strlwr_l -_strlwr_s -_strlwr_s_l -_strncoll -_strncoll_l -_strnicmp -_strnicmp_l -_strnicoll -_strnicoll_l -_strnset -_strnset_s -_strrev -_strset -_strset_s -_strtime -; _strtime_s replaced by emu -_strtod_l -_strtoi64 -strtoll == _strtoi64 -strtoimax == _strtoi64 -_strtoi64_l -_strtoll_l == _strtoi64_l -_strtoimax_l == _strtoi64_l -_strtol_l -_strtoui64 -strtoull == _strtoui64 -strtoumax == _strtoui64 -_strtoui64_l -_strtoull_l == _strtoui64_l -_strtoumax_l == _strtoui64_l -_strtoul_l -_strupr -_strupr_l -_strupr_s -_strupr_s_l -_strxfrm_l -_swab -_swprintf == swprintf -F_NON_I386(_swprintf_c) -_swprintf_c_l -_swprintf_p_l -_swprintf_s_l -_swscanf_l -_swscanf_s_l -_sys_errlist DATA -_sys_nerr DATA -_tell -_telli64 -_tempnam -F_ARM_ANY(_tempnam_dbg) -F_I386(_time32 == time) -F_ARM_ANY(_time32) -_time64 -_timezone DATA -_tolower -_tolower_l -_toupper -_toupper_l -_towlower_l -_towupper_l -_tzname DATA -_tzset -_ui64toa -_ui64toa_s -_ui64tow -_ui64tow_s -_ultoa -_ultoa_s -_ultow -_ultow_s -_umask -; _umask_s replaced by emu -_ungetch -_ungetwch -_unlink -F_X86_ANY(_unloaddll) -_unlock -_utime -F_I386(_utime32 == _utime) -F_NON_I386(_utime32) -_utime64 -_vcprintf -_vcprintf_l -_vcprintf_p -_vcprintf_p_l -; _vcprintf_s Replaced by emu -; _vcprintf_s_l Likewise. -_vcwprintf -_vcwprintf_l -_vcwprintf_p -_vcwprintf_p_l -; _vcwprintf_s Replaced by emu -; _vcwprintf_s_l Likewise. -_vfprintf_l -_vfprintf_p -_vfprintf_p_l -_vfprintf_s_l -_vfwprintf_l -_vfwprintf_p -_vfwprintf_p_l -_vfwprintf_s_l -_vprintf_l -_vprintf_p -_vprintf_p_l -_vprintf_s_l -F_NON_I386(_vscprintf) ; i386 _vscprintf replaced by emu -_vscprintf_l -_vscprintf_p_l -_vscwprintf -_vscwprintf_l -_vscwprintf_p_l -_vsnprintf -_vsnprintf_c -_vsnprintf_c_l -_vsnprintf_l -_vsnprintf_s -_vsnprintf_s_l -_vsnwprintf -vsnwprintf == _vsnwprintf -_vsnwprintf_l -_vsnwprintf_s -_vsnwprintf_s_l -_vsprintf_l -_vsprintf_p -_vsprintf_p_l -_vsprintf_s_l -_vswprintf F_I386(== vswprintf) -_vswprintf_c -_vswprintf_c_l -_vswprintf_l -_vswprintf_p_l -_vswprintf_s_l -_vwprintf_l -_vwprintf_p -_vwprintf_p_l -_vwprintf_s_l -_waccess -; _waccess_s Replaced by emu -_wasctime -; _wasctime_s Replaced by emu -F_NON_I386(_wassert) -_wchdir -_wchmod -_wcmdln DATA -_wcreat -_wcscoll_l -_wcsdup -F_ARM_ANY(_wcsdup_dbg) -_wcserror -_wcserror_s -_wcsftime_l -_wcsicmp -_wcsicmp_l -_wcsicoll -_wcsicoll_l -_wcslwr -wcslwr == _wcslwr -_wcslwr_l -_wcslwr_s -_wcslwr_s_l -_wcsncoll -_wcsncoll_l -_wcsnicmp -_wcsnicmp_l -_wcsnicoll -_wcsnicoll_l -_wcsnset -_wcsnset_s -_wcsrev -_wcsset -_wcsset_s -F_ARM_ANY(_wcstod_l) -_wcstoi64 -_wcstoi64_l -_wcstol_l -_wcstombs_l -_wcstombs_s_l -_wcstoui64 -_wcstoui64_l -_wcstoul_l -_wcsupr -_wcsupr_l -_wcsupr_s -_wcsupr_s_l -_wcsxfrm_l -_wctime -F_I386(_wctime32 == _wctime) -F_ARM_ANY(_wctime32) -; _wctime32_s replaced by emu -_wctime64 -; _wctime64_s replaced by emu -_wctomb_l -_wctomb_s_l -_wctype -F_X86_ANY(_wenviron DATA) -_wexecl -_wexecle -_wexeclp -_wexeclpe -_wexecv -_wexecve -_wexecvp -_wexecvpe -_wfdopen -_wfindfirst -F32(_wfindfirst32 == _wfindfirst) -_wfindfirst64 -_wfindfirsti64 -F32(_wfindfirst32i64 == _wfindfirsti64) -F64(_wfindfirst64i32 == _wfindfirst) -_wfindnext -F32(_wfindnext32 == _wfindnext) -_wfindnext64 -_wfindnexti64 -F32(_wfindnext32i64 == _wfindnexti64) -F64(_wfindnext64i32 == _wfindnext) -_wfopen -_wfopen_s -_wfreopen -_wfreopen_s -_wfsopen -_wfullpath -F_ARM_ANY(_wfullpath_dbg) -_wgetcwd -_wgetdcwd -_wgetenv -_wgetenv_s -_winmajor DATA -_winminor DATA -_winput_s -F_X86_ANY(_winver DATA) -_wmakepath -_wmakepath_s -_wmkdir -_wmktemp -; _wmktemp_s replaced by emu -_wopen -_woutput_s -_wperror -_wpgmptr DATA -_wpopen -_wprintf_l -_wprintf_p -_wprintf_p_l -_wprintf_s_l -_wputenv -_wputenv_s -_wremove -_wrename -_write -_wrmdir -_wscanf_l -_wscanf_s_l -_wsearchenv -_wsearchenv_s -_wsetlocale -_wsopen -_wsopen_s -_wspawnl -_wspawnle -_wspawnlp -_wspawnlpe -_wspawnv -_wspawnve -_wspawnvp -_wspawnvpe -_wsplitpath -_wsplitpath_s -_wstat -_wstat64 -_wstati64 -F32(_wstat32 == _wstat) -F64(_wstat64i32 == _wstat) -_wstrdate -; _wstrdate_s replaced by emu -_wstrtime -; _wstrtime_s replaced by emu -_wsystem -_wtempnam -F_ARM_ANY(_wtempnam_dbg) -_wtmpnam -_wtmpnam_s -_wtof -_wtof_l -_wtoi -_wtoi64 -_wtoi64_l -_wtoi_l -_wtol -_wtol_l -_wunlink -_wutime -F_I386(_wutime32 == _wutime) -F_NON_I386(_wutime32) -_wutime64 -_y0 -_y1 -_yn -abort -abs -acos -F_NON_I386(acosf F_X86_ANY(DATA)) -F_ARM_ANY(acosl == acos) -asctime -; asctime_s replaced by emu -asin -F_NON_I386(asinf F_X86_ANY(DATA)) -F_ARM_ANY(asinl == asin) -atan -atan2 F_X86_ANY(DATA) -F_NON_I386(atan2f F_X86_ANY(DATA)) -F_ARM_ANY(atan2l == atan2) -F_NON_I386(atanf F_X86_ANY(DATA)) -F_ARM_ANY(atanl == atan) -atexit DATA -atof -atoi -atol -bsearch -bsearch_s -F_ARM_ANY(btowc) -calloc -ceil F_X86_ANY(DATA) -F_NON_I386(ceilf F_X86_ANY(DATA)) -F_ARM_ANY(ceill == ceil) -clearerr -clearerr_s -clock -cos F_X86_ANY(DATA) -F_NON_I386(cosf F_X86_ANY(DATA)) -F_ARM_ANY(cosl == cos) -cosh -F_NON_I386(coshf DATA) -ctime -difftime -div -exit -exp F_X86_ANY(DATA) -F_NON_I386(expf F_X86_ANY(DATA)) -F_ARM_ANY(expl == exp) -fabs DATA -F_ARM_ANY(fabsf) -fclose -feof -ferror -fflush -fgetc -fgetpos -fgets -fgetwc -fgetws -floor F_X86_ANY(DATA) -F_NON_I386(floorf F_X86_ANY(DATA)) -F_ARM_ANY(floorl == floor) -fmod F_X86_ANY(DATA) -F_NON_I386(fmodf F_X86_ANY(DATA)) -F_ARM_ANY(fmodl == fmod) -fopen -fopen_s -fprintf -__ms_fprintf == fprintf -fprintf_s -fputc -fputs -fputwc -fputws -fread -free -freopen -freopen_s -frexp DATA -fscanf -__ms_fscanf == fscanf -fscanf_s -fseek -fsetpos -ftell -fwprintf -__ms_fwprintf == fwprintf -fwprintf_s -fwrite -fwscanf -__ms_fwscanf == fwscanf -fwscanf_s -getc -getchar -getenv -getenv_s -F_X86_ANY(gets) -getwc -getwchar -gmtime -is_wctype -isalnum -isalpha -iscntrl -isdigit -isgraph -isleadbyte -islower -isprint -ispunct -isspace -isupper -iswalnum -iswalpha -iswascii -iswcntrl -iswctype -iswdigit -iswgraph -iswlower -iswprint -iswpunct -iswspace -iswupper -iswxdigit -isxdigit -labs -ldexp F_X86_ANY(DATA) -ldiv -localeconv -localtime -log F_X86_ANY(DATA) -log10 -F_NON_I386(log10f F_X86_ANY(DATA)) -F_ARM_ANY(log10l == log10) -F_NON_I386(logf F_X86_ANY(DATA)) -F_ARM_ANY(logl == log) -longjmp -malloc -mblen -F_ARM_ANY(mbrlen) -F_ARM_ANY(mbrtowc) -F_ARM_ANY(mbsdup_dbg) -F_ARM_ANY(mbsrtowcs) -mbsrtowcs_s -mbstowcs -mbstowcs_s -mbtowc -memchr -memcmp -memcpy -; memcpy_s replaced by emu -memmove -; memmove_s replaced by emu -memset -mktime -modf DATA -F_NON_I386(modff DATA) -perror -pow DATA -F_NON_I386(powf DATA) -printf -__ms_printf == printf -printf_s -putc -putchar -puts -putwc -putwchar -qsort -qsort_s -raise -rand -; rand_s replaced by emu -realloc -remove -rename -rewind -scanf -__ms_scanf == scanf -scanf_s -setbuf -F_NON_I386(setjmp) -setlocale -setvbuf -signal -sin F_X86_ANY(DATA) -F_NON_I386(sinf F_X86_ANY(DATA)) -F_ARM_ANY(sinl == sin) -; if we implement sinh, we can set it DATA only. -sinh -F_NON_I386(sinhf DATA) -sprintf -__ms_sprintf == sprintf -; sprintf_s replaced by emu -sqrt DATA -F_NON_I386(sqrtf DATA) -srand -sscanf -__ms_sscanf == sscanf -sscanf_s -strcat -strcat_s -strchr -strcmp -strcoll -strcpy -strcpy_s -strcspn -strerror -; strerror_s replaced by emu -strftime -strlen -strncat -strncat_s -strncmp -strncpy -strncpy_s -; strnlen replaced by emu -strpbrk -strrchr -strspn -strstr -strtod -strtok -strtok_s -strtol -strtoul -strxfrm -swprintf -__ms_swprintf == swprintf -swprintf_s -swscanf -__ms_swscanf == swscanf -swscanf_s -system -tan -F_NON_I386(tanf F_X86_ANY(DATA)) -F_ARM_ANY(tanl == tan) -; if we implement tanh, we can set it to DATA only. -tanh -F_ARM_ANY(tanhf) -time F_NON_I386(== _time64) -tmpfile -tmpfile_s -tmpnam -tmpnam_s -tolower -toupper -towlower -towupper -ungetc -ungetwc -F_ARM_ANY(utime) -vfprintf -__ms_vfprintf == vfprintf -vfprintf_s -vfwprintf -__ms_vfwprintf == vfwprintf -vfwprintf_s -vprintf -__ms_vprintf == vprintf -vprintf_s -vsprintf -__ms_vsprintf == vsprintf -; vsprintf_s replaced by emu -vswprintf -__ms_vswprintf == vswprintf -vswprintf_s -vwprintf -__ms_vwprintf == vwprintf -vwprintf_s -F_ARM_ANY(wcrtomb) -wcrtomb_s -wcscat -wcscat_s -wcschr -wcscmp -wcscoll -wcscpy -wcscpy_s -wcscspn -wcsftime -wcslen -wcsncat -wcsncat_s -wcsncmp -wcsncpy -wcsncpy_s -; We provide replacement implementation in libmingwex -wcsnlen DATA -wcspbrk -wcsrchr -F_ARM_ANY(wcsrtombs) -wcsrtombs_s -wcsspn -wcsstr -wcstod -wcstok -wcstok_s -wcstol -wcstombs -wcstombs_s -wcstoul -wcsxfrm -F_ARM_ANY(wctob) -wctomb -wctomb_s -wprintf -__ms_wprintf == wprintf -wprintf_s -wscanf -__ms_wscanf == wscanf -wscanf_s diff --git a/lib/libc/mingw/lib32/crtdll.def.in b/lib/libc/mingw/lib32/crtdll.def.in deleted file mode 100644 index d8b5bd82114e..000000000000 --- a/lib/libc/mingw/lib32/crtdll.def.in +++ /dev/null @@ -1,726 +0,0 @@ -; -;* crtdll.def -;* This file has no copyright assigned and is placed in the Public Domain. -;* This file is part of the mingw-runtime package. -;* No warranty is given; refer to the file DISCLAIMER.PD within the package. -; -; Exports from crtdll.dll from Windows 95 SYSTEM directory. Hopefully this -; should also work with the crtdll provided with Windows NT. -; -; NOTE: The crtdll is OBSOLETE and msvcrt should be used instead. The msvcrt -; is available for free download from Microsoft Corporation and will work on -; Windows 95. Support for the crtdll is deprecated and this file may be -; deleted in future versions. -; -; These three functions appear to be name mangled in some way, so GCC is -; probably not going to be able to use them in any case. -; -; ??2@YAPAXI@Z -; ??3@YAXPAX@Z -; ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z -; -; These are functions for which I have not yet written prototypes or -; otherwise set up (they are still included below though unlike those -; first three). -; -; _CIacos -; _CIasin -; _CIatan -; _CIatan2 -; _CIcos -; _CIcosh -; _CIexp -; _CIfmod -; _CIlog -; _CIlog10 -; _CIpow -; _CIsin -; _CIsinh -; _CIsqrt -; _CItan -; _CItanh -; __dllonexit -; __mb_cur_max_dll -; __threadhandle -; __threadid -; _abnormal_termination -; _acmdln_dll -; _aexit_rtn_dll -; _amsg_exit -; _commit -; _commode_dll -; _cpumode_dll -; _ctype -; _expand -; _fcloseall -; _filbuf -; _fileinfo_dll -; _flsbuf -; _flushall -; _fmode_dll -; _fpieee_flt -; _fsopen -; _ftol -; _getdiskfree -; _getdllprocaddr -; _getdrive -; _getdrives -; _getsystime -; _initterm -; _ismbbalnum -; _ismbbalpha -; _ismbbgraph -; _ismbbkalnum -; _ismbbkana -; _ismbbkpunct -; _ismbblead -; _ismbbprint -; _ismbbpunct -; _ismbbtrail -; _ismbcalpha -; _ismbcdigit -; _ismbchira -; _ismbckata -; _ismbcl0 -; _ismbcl1 -; _ismbcl2 -; _ismbclegal -; _ismbclower -; _ismbcprint -; _ismbcspace -; _ismbcsymbol -; _ismbcupper -; _ismbslead -; _ismbstrail -; _lfind -; _loaddll -; _lrotl -; _lrotr -; _lsearch -; _makepath -; _matherr -; _mbbtombc -; _mbbtype -; _mbccpy -; _mbcjistojms -; _mbcjmstojis -; _mbclen -; _mbctohira -; _mbctokata -; _mbctolower -; _mbctombb -; _mbctoupper -; _mbctype -; _mbsbtype -; _mbscat -; _mbscmp -; _mbscpy -; _mbscspn -; _mbsdec -; _mbsdup -; _mbsicmp -; _mbsinc -; _mbslen -; _mbslwr -; _mbsnbcat -; _mbsnbcmp -; _mbsnbcnt -; _mbsnbcpy -; _mbsnbicmp -; _mbsnbset -; _mbsnccnt -; _mbsncmp -; _mbsncpy -; _mbsnextc -; _mbsnicmp -; _mbsninc -; _mbsnset -; _mbspbrk -; _mbsrchr -; _mbsrev -; _mbsset -; _mbsspn -; _mbsspnp -; _mbsstr -; _mbstrlen -; _mbsupr -; _onexit -; _osversion_dll -; _pctype_dll -; _purecall -; _pwctype_dll -; _rmtmp -; _rotl -; _rotr -; _setsystime -; _snprintf -; _snwprintf -; _splitpath -; _strdate -; _strdec -; _strinc -; _strncnt -; _strnextc -; _strninc -; _strspnp -; _strtime -; _tempnam -; _ultoa -; _unloaddll -; _vsnprintf -; _vsnwprintf -; _wtoi -; _wtol -; -LIBRARY "crtdll.dll" -EXPORTS - -#include "msvcrt-common.def.in" - -_CIacos -_CIasin -_CIatan -_CIatan2 -_CIcos -_CIcosh -_CIexp -_CIfmod -_CIlog -_CIlog10 -_CIpow -_CIsin -_CIsinh -_CIsqrt -_CItan -_CItanh -_HUGE_dll DATA -_HUGE DATA == _HUGE_dll -_XcptFilter -__GetMainArgs -__argc_dll DATA -__argc DATA == __argc_dll -__argv_dll DATA -__argv DATA == __argv_dll -__dllonexit -__doserrno -__fpecode -__isascii -__iscsym -__iscsymf -__mb_cur_max_dll DATA -__mb_cur_max DATA == __mb_cur_max_dll -__pxcptinfoptrs -__threadhandle -__threadid -__toascii -_abnormal_termination -_access -_acmdln_dll DATA -_acmdln DATA == _acmdln_dll -_aexit_rtn_dll DATA -_aexit_rtn DATA == _aexit_rtn_dll -_amsg_exit -_assert -_basemajor_dll DATA -_baseminor_dll DATA -_baseversion_dll DATA -_beep -_beginthread -_c_exit -_cabs DATA -_cexit -_cgets -_chdir -_chdrive -_chgsign -_chmod -_chsize -_clearfp -_close -_commit -_commode_dll DATA -_commode DATA == _commode_dll -_control87 -_controlfp -_copysign -_cprintf -_cpumode_dll DATA -_cputs -_creat -_cscanf -_ctype DATA -_cwait -_daylight_dll DATA -_daylight DATA == _daylight_dll -_dup -_dup2 -_ecvt -_endthread -_environ_dll DATA -_environ DATA == _environ_dll -_eof -_errno -_except_handler2 -_execl -_execle -_execlp -_execlpe -_execv -_execve -_execvp -_execvpe -_exit -_expand -_fcloseall -_fcvt -_fdopen -_fgetchar -_fgetwchar -_filbuf -_fileinfo_dll DATA -_fileinfo DATA == _fileinfo_dll -_filelength -_fileno -_findclose -_findfirst -_findnext -_finite -_flsbuf -_flushall -_fmode_dll DATA -_fmode DATA == _fmode_dll -_fpclass -_fpieee_flt -_fpreset DATA -_fputchar -_fputwchar -_fsopen -_fstat -_ftime -_ftol -_fullpath -_futime -_gcvt -_get_osfhandle -_getch -_getche -_getcwd -_getdcwd -_getdiskfree -_getdllprocaddr -_getdrive -_getdrives -_getpid -_getsystime -_getw -_global_unwind2 -_heapchk -_heapmin -_heapset -_heapwalk -_hypot -_initterm -_iob DATA -_isatty -_isctype -_ismbbalnum -_ismbbalpha -_ismbbgraph -_ismbbkalnum -_ismbbkana -_ismbbkpunct -_ismbblead -_ismbbprint -_ismbbpunct -_ismbbtrail -_ismbcalpha -_ismbcdigit -_ismbchira -_ismbckata -_ismbcl0 -_ismbcl1 -_ismbcl2 -_ismbclegal -_ismbclower -_ismbcprint -_ismbcspace -_ismbcsymbol -_ismbcupper -_ismbslead -_ismbstrail -_isnan -_itoa -_j0 -_j1 -_jn -_kbhit -_lfind -_loaddll -_local_unwind2 -_locking -_logb -_lrotl -_lrotr -_lsearch -_lseek -_ltoa -_makepath -_matherr -_mbbtombc -_mbbtype -_mbccpy -_mbcjistojms -_mbcjmstojis -_mbclen -_mbctohira -_mbctokata -_mbctolower -_mbctombb -_mbctoupper -_mbctype DATA -_mbsbtype -_mbscat -_mbschr -_mbscmp -_mbscpy -_mbscspn -_mbsdec -_mbsdup -_mbsicmp -_mbsinc -_mbslen -_mbslwr -_mbsnbcat -_mbsnbcmp -_mbsnbcnt -_mbsnbcpy -_mbsnbicmp -_mbsnbset -_mbsncat -_mbsnccnt -_mbsncmp -_mbsncpy -_mbsnextc -_mbsnicmp -_mbsninc -_mbsnset -_mbspbrk -_mbsrchr -_mbsrev -_mbsset -_mbsspn -_mbsspnp -_mbsstr -_mbstok -_mbstrlen -_mbsupr -_memccpy -_memicmp -_mkdir -_mktemp -_msize -_nextafter -_onexit -_open -_open_osfhandle -_osmajor_dll DATA -_osminor_dll DATA -_osmode_dll DATA -_osver_dll DATA -_osver DATA == _osver_dll -_osversion_dll DATA -_pclose -_pctype_dll DATA -_pctype DATA == _pctype_dll -_pgmptr_dll DATA -_pgmptr DATA == _pgmptr_dll -_pipe -_popen -_purecall -_putch -_putenv -_putw -_pwctype_dll DATA -_pwctype DATA == _pwctype_dll -_read -_rmdir -_rmtmp -_rotl -_rotr -_scalb -_searchenv -_seterrormode -_setjmp -_setmode -_setsystime -_sleep -_snprintf -_snwprintf -_sopen -_spawnl -_spawnle -_spawnlp -_spawnlpe -_spawnv -_spawnve -_spawnvp -_spawnvpe -_splitpath -_stat -_statusfp -_strcmpi -_strdate -_strdec -_strdup -_strerror -_stricmp -_stricoll -_strinc -_strlwr -strlwr == _strlwr -_strncnt -_strnextc -_strnicmp -_strninc -_strnset -_strrev -_strset -_strspnp -_strtime -_strupr -_swab -_sys_errlist DATA -_sys_nerr_dll DATA -_sys_nerr DATA == _sys_nerr_dll -_tell -_tempnam -_timezone_dll DATA -_timezone DATA == _timezone_dll -_tolower -_toupper -_tzname DATA -_tzset -_ultoa -_umask -_ungetch -_unlink -_unloaddll -_utime -_vsnprintf -_vsnwprintf -_wcsdup -_wcsicmp -_wcsicoll -_wcslwr -wcslwr == _wcslwr -_wcsnicmp -_wcsnset -_wcsrev -_wcsset -_wcsupr -_winmajor_dll DATA -_winmajor DATA == _winmajor_dll -_winminor_dll DATA -_winminor DATA == _winminor_dll -_winver_dll DATA -_winver DATA == _winver_dll -_write -_wtoi -_wtol -_y0 -_y1 -_yn -abort -abs -acos -asctime -asin DATA -atan DATA -atan2 DATA -atexit DATA -atof -atoi -atol -bsearch -calloc -ceil -clearerr -clock -cos DATA -cosh -ctime DATA -;_ctime32 = ctime -difftime -div -exit -exp DATA -fabs DATA -fclose -feof -ferror -fflush -fgetc -fgetpos -fgets -fgetwc -floor -fmod -fopen -fprintf -fputc -fputs -fputwc -fread -free -freopen -frexp -fscanf -fseek -fsetpos -ftell -fwprintf -fwrite -fwscanf -getc -getchar -getenv -gets -gmtime DATA -;_gmtime32 = gmtime -is_wctype -isalnum -isalpha -iscntrl -isdigit -isgraph -isleadbyte -islower -isprint -ispunct -isspace -isupper -iswalnum -iswalpha -iswascii -iswcntrl -iswctype -iswdigit -iswgraph -iswlower -iswprint -iswpunct -iswspace -iswupper -iswxdigit -isxdigit -labs -ldexp DATA -ldiv -localeconv -localtime DATA -;_localtime32 = localtime -log -log10 -longjmp -malloc -mblen -mbstowcs -mbtowc -memchr -memcmp -memcpy -memmove -memset -mktime DATA -;_mktime32 = mktime -modf -perror -pow -printf -putc -putchar -puts -qsort -raise -rand -realloc -remove -rename -rewind -scanf -setbuf -setlocale -setvbuf -signal -sin -sinh -sprintf -sqrt -srand -sscanf -strcat -strchr -strcmp -strcoll -strcpy -strcspn -strerror -strftime -strlen -strncat -strncmp -strncpy -strpbrk -strrchr -strspn -strstr -strtod -strtok -strtol -strtoul -strxfrm -swprintf -swscanf -system -tan -tanh -time DATA -;_time32 = time -tmpfile -tmpnam -tolower -toupper -towlower -towupper -ungetc -ungetwc -vfprintf -vfwprintf -vprintf -vsprintf -vswprintf -vwprintf -wcscat -wcschr -wcscmp -wcscoll -wcscpy -wcscspn -wcsftime -wcslen -wcsncat -wcsncmp -wcsncpy -wcspbrk -wcsrchr -wcsspn -wcsstr -wcstod -wcstok -wcstol -wcstombs -wcstoul -wcsxfrm -wctomb -wprintf -wscanf diff --git a/lib/libc/mingw/lib32/msvcp60.def b/lib/libc/mingw/lib32/msvcp60.def deleted file mode 100644 index f6a5dc93f3a0..000000000000 --- a/lib/libc/mingw/lib32/msvcp60.def +++ /dev/null @@ -1,71 +0,0 @@ -;Submitted by: Danny Smith -;Only the C functions are listed. Most of these have been commented out since -;I don't know what they are and can't test them. Some look like data exports -;for C++ math functions (E.G.: _Xbig). -LIBRARY MSVCP60.DLL -EXPORTS -;_Cosh -;_Denorm -;_Dnorm -;_Dscale -;_Dtest -;_Eps -;_Exp -;_FCosh -;_FDenorm -;_FDnorm -;_FDscale -;_FDtest -;_FEps -;_FExp -;_FInf -;_FNan -;_FRteps -;_FSinh -;_FSnan -;_FXbig -;_Getcoll -;_Getctype -;_Getcvt -;_Hugeval -;_Inf -;_LCosh -;_LDenorm -;_LDscale -;_LDtest -;_LEps -;_LExp -;_LInf -;_LNan -;_LPoly -;_LRteps -;_LSinh -;_LSnan -;_LXbig -;_Mbrtowc -;_Nan -;_Poly -;_Rteps -;_Sinh -;_Snan -;_Stod -;_Stof -;_Stold -;_Strcoll -;_Strxfrm -;_Tolower -;_Toupper -;_Wcrtomb -;__Wcrtomb_lk -;_Xbig - -btowc -mbrlen -mbrtowc -mbsrtowcs -towctrans -wcrtomb -wcsrtombs -wctob -wctrans -wctype \ No newline at end of file diff --git a/lib/libc/mingw/math/arm-common/acosh.c b/lib/libc/mingw/math/arm-common/acosh.c deleted file mode 100644 index a26840d862ce..000000000000 --- a/lib/libc/mingw/math/arm-common/acosh.c +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -double acosh(double x) -{ - if (x < 1.0) - return NAN; - if (isinf(x*x)) - return log(2) + log(x); - return log(x + sqrt(x*x - 1)); -} diff --git a/lib/libc/mingw/math/arm-common/acoshf.c b/lib/libc/mingw/math/arm-common/acoshf.c deleted file mode 100644 index d02e94da62ff..000000000000 --- a/lib/libc/mingw/math/arm-common/acoshf.c +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -float acoshf(float x) -{ - if (x < 1.0) - return NAN; - if (isinf(x*x)) - return logf(2) + logf(x); - return logf(x + sqrtf(x*x - 1)); -} diff --git a/lib/libc/mingw/math/arm-common/acoshl.c b/lib/libc/mingw/math/arm-common/acoshl.c deleted file mode 100644 index c2157bebc94c..000000000000 --- a/lib/libc/mingw/math/arm-common/acoshl.c +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -long double acoshl(long double x) -{ -#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) - return acosh(x); -#else -#error Not supported on your platform yet -#endif -} diff --git a/lib/libc/mingw/math/arm-common/asinh.c b/lib/libc/mingw/math/arm-common/asinh.c deleted file mode 100644 index a5a8da7ba5fe..000000000000 --- a/lib/libc/mingw/math/arm-common/asinh.c +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -double asinh(double x) -{ - if (isinf(x*x + 1)) { - if (x > 0) - return log(2) + log(x); - else - return -log(2) - log(-x); - } - return log(x + sqrt(x*x + 1)); -} diff --git a/lib/libc/mingw/math/arm-common/asinhf.c b/lib/libc/mingw/math/arm-common/asinhf.c deleted file mode 100644 index f1ccea20304b..000000000000 --- a/lib/libc/mingw/math/arm-common/asinhf.c +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -float asinhf(float x) -{ - if (isinf(x*x + 1)) { - if (x > 0) - return logf(2) + logf(x); - else - return -logf(2) - logf(-x); - } - return logf(x + sqrtf(x*x + 1)); -} diff --git a/lib/libc/mingw/math/arm-common/asinhl.c b/lib/libc/mingw/math/arm-common/asinhl.c deleted file mode 100644 index 556b3c4f514e..000000000000 --- a/lib/libc/mingw/math/arm-common/asinhl.c +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -long double asinhl(long double x) -{ -#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) - return asinh(x); -#else -#error Not supported on your platform yet -#endif -} diff --git a/lib/libc/mingw/math/arm-common/atanh.c b/lib/libc/mingw/math/arm-common/atanh.c deleted file mode 100644 index 08302c0e2e80..000000000000 --- a/lib/libc/mingw/math/arm-common/atanh.c +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -double atanh(double x) -{ - if (x > 1 || x < -1) - return NAN; - if (-1e-6 < x && x < 1e-6) - return x + x*x*x/3; - else - return (log(1 + x) - log(1 - x)) / 2; -} diff --git a/lib/libc/mingw/math/arm-common/atanhf.c b/lib/libc/mingw/math/arm-common/atanhf.c deleted file mode 100644 index a29492305e86..000000000000 --- a/lib/libc/mingw/math/arm-common/atanhf.c +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -float atanhf(float x) -{ - if (x > 1 || x < -1) - return NAN; - if (-1e-6 < x && x < 1e-6) - return x + x*x*x/3; - else - return (logf(1 + x) - logf(1 - x)) / 2; -} diff --git a/lib/libc/mingw/math/arm-common/atanhl.c b/lib/libc/mingw/math/arm-common/atanhl.c deleted file mode 100644 index c4d124b9f459..000000000000 --- a/lib/libc/mingw/math/arm-common/atanhl.c +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -long double atanhl(long double x) -{ -#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) - return atanh(x); -#else -#error Not supported on your platform yet -#endif -} diff --git a/lib/libc/mingw/math/arm-common/copysignl.c b/lib/libc/mingw/math/arm-common/copysignl.c deleted file mode 100644 index ea66215f2d53..000000000000 --- a/lib/libc/mingw/math/arm-common/copysignl.c +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -long double copysignl(long double x, long double y) -{ - return copysign(x, y); -} diff --git a/lib/libc/mingw/math/arm-common/expm1.c b/lib/libc/mingw/math/arm-common/expm1.c deleted file mode 100644 index 578bb446aae1..000000000000 --- a/lib/libc/mingw/math/arm-common/expm1.c +++ /dev/null @@ -1,12 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -double expm1(double x) -{ - return exp(x) - 1.0; -} diff --git a/lib/libc/mingw/math/arm-common/expm1f.c b/lib/libc/mingw/math/arm-common/expm1f.c deleted file mode 100644 index a810b71862ff..000000000000 --- a/lib/libc/mingw/math/arm-common/expm1f.c +++ /dev/null @@ -1,15 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -float expm1f(float x) -{ - // Intentionally using double version of exp() here in the float version of - // expm1, to preserve as much accuracy as possible in the intermediate - // result. - return exp(x) - 1.0; -} diff --git a/lib/libc/mingw/math/arm-common/expm1l.c b/lib/libc/mingw/math/arm-common/expm1l.c deleted file mode 100644 index baf4da23af14..000000000000 --- a/lib/libc/mingw/math/arm-common/expm1l.c +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -long double expm1l(long double x) -{ -#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) - return expm1(x); -#else -#error Not supported on your platform yet -#endif -} diff --git a/lib/libc/mingw/math/arm-common/ilogb.c b/lib/libc/mingw/math/arm-common/ilogb.c deleted file mode 100644 index 546db4243796..000000000000 --- a/lib/libc/mingw/math/arm-common/ilogb.c +++ /dev/null @@ -1,19 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include -#include - -int ilogb(double x) -{ - if (x == 0.0) - return FP_ILOGB0; - if (isinf(x)) - return INT_MAX; - if (isnan(x)) - return FP_ILOGBNAN; - return (int) logb(x); -} diff --git a/lib/libc/mingw/math/arm-common/ilogbf.c b/lib/libc/mingw/math/arm-common/ilogbf.c deleted file mode 100644 index 3df38411ec6f..000000000000 --- a/lib/libc/mingw/math/arm-common/ilogbf.c +++ /dev/null @@ -1,19 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include -#include - -int ilogbf(float x) -{ - if (x == 0.0) - return FP_ILOGB0; - if (isinf(x)) - return INT_MAX; - if (isnan(x)) - return FP_ILOGBNAN; - return (int) logbf(x); -} diff --git a/lib/libc/mingw/math/arm-common/ilogbl.c b/lib/libc/mingw/math/arm-common/ilogbl.c deleted file mode 100644 index 1a6865d46ead..000000000000 --- a/lib/libc/mingw/math/arm-common/ilogbl.c +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -int ilogbl(long double x) -{ -#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) - return ilogb(x); -#else -#error Not supported on your platform yet -#endif -} diff --git a/lib/libc/mingw/math/arm-common/log1p.c b/lib/libc/mingw/math/arm-common/log1p.c deleted file mode 100644 index ea75d75b5d93..000000000000 --- a/lib/libc/mingw/math/arm-common/log1p.c +++ /dev/null @@ -1,12 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -double log1p(double x) -{ - return log(x + 1.0); -} diff --git a/lib/libc/mingw/math/arm-common/log1pf.c b/lib/libc/mingw/math/arm-common/log1pf.c deleted file mode 100644 index e947131260de..000000000000 --- a/lib/libc/mingw/math/arm-common/log1pf.c +++ /dev/null @@ -1,15 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -float log1pf(float x) -{ - // Intentionally using double version of log() here in the float version of - // log1p, to preserve as much accuracy as possible in the intermediate - // parameter. - return log(x + 1.0); -} diff --git a/lib/libc/mingw/math/arm-common/log1pl.c b/lib/libc/mingw/math/arm-common/log1pl.c deleted file mode 100644 index c2b321a26da4..000000000000 --- a/lib/libc/mingw/math/arm-common/log1pl.c +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -long double log1pl(long double x) -{ -#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) - return log1p(x); -#else -#error Not supported on your platform yet -#endif -} diff --git a/lib/libc/mingw/math/arm-common/log2.c b/lib/libc/mingw/math/arm-common/log2.c deleted file mode 100644 index 42ae3eeeb7c4..000000000000 --- a/lib/libc/mingw/math/arm-common/log2.c +++ /dev/null @@ -1,55 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include -#include - -typedef union ieee754_double_ { - struct __attribute__((__packed__)) { - uint64_t f52 : 52; - uint64_t exp : 11; - uint64_t sgn : 1; - }; - double f; -} ieee754_double; - -typedef union ieee754_float_ { - struct __attribute__((__packed__)) { - uint32_t f23 : 23; - uint32_t exp : 8; - uint32_t sgn : 1; - }; - float f; -} ieee754_float; - -double log2(double x) -{ - ieee754_double u = { .f = x }; - if (u.sgn == 0 && u.f52 == 0 && u.exp > 0 && u.exp < 0x7ff) { - // Handle exact powers of two exactly - return (int)u.exp - 1023; - } - return log(x) / 0.69314718246459960938; -} - -float log2f(float x) -{ - ieee754_float u = { .f = x }; - if (u.sgn == 0 && u.f23 == 0 && u.exp > 0 && u.exp < 0xff) { - // Handle exact powers of two exactly - return (int)u.exp - 127; - } - return logf(x) / 0.69314718246459960938f; -} - -long double log2l(long double x) -{ -#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) - return log2(x); -#else -#error Not supported on your platform yet -#endif -} diff --git a/lib/libc/mingw/math/arm-common/logb.c b/lib/libc/mingw/math/arm-common/logb.c deleted file mode 100644 index 105a44c09fbe..000000000000 --- a/lib/libc/mingw/math/arm-common/logb.c +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include -#include - -extern double (* __MINGW_IMP_SYMBOL(_logb))(double); - -double logb(double x) -{ - if (isinf(x)) - return INFINITY; - return __MINGW_IMP_SYMBOL(_logb)(x); -} diff --git a/lib/libc/mingw/math/arm-common/logbf.c b/lib/libc/mingw/math/arm-common/logbf.c deleted file mode 100644 index 565b66aebbe0..000000000000 --- a/lib/libc/mingw/math/arm-common/logbf.c +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include -#include - -extern float (* __MINGW_IMP_SYMBOL(_logbf))(float); - -float logbf(float x) -{ - if (isinf(x)) - return INFINITY; - return __MINGW_IMP_SYMBOL(_logbf)(x); -} diff --git a/lib/libc/mingw/math/arm-common/logbl.c b/lib/libc/mingw/math/arm-common/logbl.c deleted file mode 100644 index fca06754df00..000000000000 --- a/lib/libc/mingw/math/arm-common/logbl.c +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -long double logbl(long double x) -{ -#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) - return logb(x); -#else -#error Not supported on your platform yet -#endif -} diff --git a/lib/libc/mingw/math/arm-common/powf.c b/lib/libc/mingw/math/arm-common/powf.c deleted file mode 100644 index 4d518fe9bbd2..000000000000 --- a/lib/libc/mingw/math/arm-common/powf.c +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include -#include - -extern float (* __MINGW_IMP_SYMBOL(powf))(float, float); - -float powf(float x, float y) -{ - if (x == 1.0f) - return 1.0f; - if (y == 0.0f) - return 1.0f; - if (x == -1.0f && isinf(y)) - return 1.0f; - return __MINGW_IMP_SYMBOL(powf)(x, y); -} diff --git a/lib/libc/mingw/math/arm-common/powl.c b/lib/libc/mingw/math/arm-common/powl.c deleted file mode 100644 index 46e6b2d4595e..000000000000 --- a/lib/libc/mingw/math/arm-common/powl.c +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -long double powl(long double x, long double y) -{ -#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) - return pow(x, y); -#else -#error Not supported on your platform yet -#endif -} diff --git a/lib/libc/mingw/math/arm-common/remainder.c b/lib/libc/mingw/math/arm-common/remainder.c deleted file mode 100644 index b97ccf13393a..000000000000 --- a/lib/libc/mingw/math/arm-common/remainder.c +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include -#include - -double remainder(double x, double y) -{ - int iret; - return remquo(x, y, &iret); -} diff --git a/lib/libc/mingw/math/arm-common/remainderf.c b/lib/libc/mingw/math/arm-common/remainderf.c deleted file mode 100644 index 1e2946c8b34a..000000000000 --- a/lib/libc/mingw/math/arm-common/remainderf.c +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include -#include - -float remainderf(float x, float y) -{ - int iret; - return remquof(x, y, &iret); -} diff --git a/lib/libc/mingw/math/arm-common/remainderl.c b/lib/libc/mingw/math/arm-common/remainderl.c deleted file mode 100644 index 16fef94651a8..000000000000 --- a/lib/libc/mingw/math/arm-common/remainderl.c +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include -#include - -long double remainderl(long double x, long double y) -{ -#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) - return remainder(x, y); -#else -#error Not supported on your platform yet -#endif -} diff --git a/lib/libc/mingw/math/arm-common/remquol.c b/lib/libc/mingw/math/arm-common/remquol.c deleted file mode 100644 index c9fb1cbb5344..000000000000 --- a/lib/libc/mingw/math/arm-common/remquol.c +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include -#include - -long double remquol(long double x, long double y, int *quo) -{ -#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) - return remquo(x, y, quo); -#else -#error Not supported on your platform yet -#endif -} diff --git a/lib/libc/mingw/math/arm-common/s_remquo.c b/lib/libc/mingw/math/arm-common/s_remquo.c deleted file mode 100644 index 48b73177a48c..000000000000 --- a/lib/libc/mingw/math/arm-common/s_remquo.c +++ /dev/null @@ -1,154 +0,0 @@ -/* @(#)e_fmod.c 1.3 95/01/18 */ -/*- - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include - -#include - -#include -#include "../bsd_private_base.h" - -static const double Zero[] = {0.0, -0.0,}; - -/* - * Return the IEEE remainder and set *quo to the last n bits of the - * quotient, rounded to the nearest integer. We choose n=31 because - * we wind up computing all the integer bits of the quotient anyway as - * a side-effect of computing the remainder by the shift and subtract - * method. In practice, this is far more bits than are needed to use - * remquo in reduction algorithms. - */ -double -remquo(double x, double y, int *quo) -{ - int32_t n,hx,hy,hz,ix,iy,sx,i; - u_int32_t lx,ly,lz,q,sxy; - - EXTRACT_WORDS(hx,lx,x); - EXTRACT_WORDS(hy,ly,y); - sxy = (hx ^ hy) & 0x80000000; - sx = hx&0x80000000; /* sign of x */ - hx ^=sx; /* |x| */ - hy &= 0x7fffffff; /* |y| */ - - /* purge off exception values */ - if((hy|ly)==0||(hx>=0x7ff00000)|| /* y=0,or x not finite */ - ((hy|((ly|-ly)>>31))>0x7ff00000)) /* or y is NaN */ - return nan_mix_op(x, y, *)/nan_mix_op(x, y, *); - if(hx<=hy) { - if((hx>31]; /* |x|=|y| return x*0*/ - } - } - - /* determine ix = ilogb(x) */ - if(hx<0x00100000) { /* subnormal x */ - if(hx==0) { - for (ix = -1043, i=lx; i>0; i<<=1) ix -=1; - } else { - for (ix = -1022,i=(hx<<11); i>0; i<<=1) ix -=1; - } - } else ix = (hx>>20)-1023; - - /* determine iy = ilogb(y) */ - if(hy<0x00100000) { /* subnormal y */ - if(hy==0) { - for (iy = -1043, i=ly; i>0; i<<=1) iy -=1; - } else { - for (iy = -1022,i=(hy<<11); i>0; i<<=1) iy -=1; - } - } else iy = (hy>>20)-1023; - - /* set up {hx,lx}, {hy,ly} and align y to x */ - if(ix >= -1022) - hx = 0x00100000|(0x000fffff&hx); - else { /* subnormal x, shift x to normal */ - n = -1022-ix; - if(n<=31) { - hx = (hx<>(32-n)); - lx <<= n; - } else { - hx = lx<<(n-32); - lx = 0; - } - } - if(iy >= -1022) - hy = 0x00100000|(0x000fffff&hy); - else { /* subnormal y, shift y to normal */ - n = -1022-iy; - if(n<=31) { - hy = (hy<>(32-n)); - ly <<= n; - } else { - hy = ly<<(n-32); - ly = 0; - } - } - - /* fix point fmod */ - n = ix - iy; - q = 0; - while(n--) { - hz=hx-hy;lz=lx-ly; if(lx>31); lx = lx+lx;} - else {hx = hz+hz+(lz>>31); lx = lz+lz; q++;} - q <<= 1; - } - hz=hx-hy;lz=lx-ly; if(lx=0) {hx=hz;lx=lz;q++;} - - /* convert back to floating value and restore the sign */ - if((hx|lx)==0) { /* return sign(x)*0 */ - q &= 0x7fffffff; - *quo = (sxy ? -q : q); - return Zero[(u_int32_t)sx>>31]; - } - while(hx<0x00100000) { /* normalize x */ - hx = hx+hx+(lx>>31); lx = lx+lx; - iy -= 1; - } - if(iy>= -1022) { /* normalize output */ - hx = ((hx-0x00100000)|((iy+1023)<<20)); - } else { /* subnormal output */ - n = -1022 - iy; - if(n<=20) { - lx = (lx>>n)|((u_int32_t)hx<<(32-n)); - hx >>= n; - } else if (n<=31) { - lx = (hx<<(32-n))|(lx>>n); hx = 0; - } else { - lx = hx>>(n-32); hx = 0; - } - } -fixup: - INSERT_WORDS(x,hx,lx); - y = fabs(y); - if (y < 0x1p-1021) { - if (x+x>y || (x+x==y && (q & 1))) { - q++; - x-=y; - } - } else if (x>0.5*y || (x==0.5*y && (q & 1))) { - q++; - x-=y; - } - GET_HIGH_WORD(hx,x); - SET_HIGH_WORD(x,hx^sx); - q &= 0x7fffffff; - *quo = (sxy ? -q : q); - return x; -} diff --git a/lib/libc/mingw/math/arm-common/s_remquof.c b/lib/libc/mingw/math/arm-common/s_remquof.c deleted file mode 100644 index f2a4e0d0810e..000000000000 --- a/lib/libc/mingw/math/arm-common/s_remquof.c +++ /dev/null @@ -1,121 +0,0 @@ -/* @(#)e_fmod.c 1.3 95/01/18 */ -/*- - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include - -#include -#include "../bsd_private_base.h" - -static const float Zero[] = {0.0, -0.0,}; - -/* - * Return the IEEE remainder and set *quo to the last n bits of the - * quotient, rounded to the nearest integer. We choose n=31 because - * we wind up computing all the integer bits of the quotient anyway as - * a side-effect of computing the remainder by the shift and subtract - * method. In practice, this is far more bits than are needed to use - * remquo in reduction algorithms. - */ -float -remquof(float x, float y, int *quo) -{ - int32_t n,hx,hy,hz,ix,iy,sx,i; - u_int32_t q,sxy; - - GET_FLOAT_WORD(hx,x); - GET_FLOAT_WORD(hy,y); - sxy = (hx ^ hy) & 0x80000000; - sx = hx&0x80000000; /* sign of x */ - hx ^=sx; /* |x| */ - hy &= 0x7fffffff; /* |y| */ - - /* purge off exception values */ - if(hy==0||hx>=0x7f800000||hy>0x7f800000) /* y=0,NaN;or x not finite */ - return nan_mix_op(x, y, *)/nan_mix_op(x, y, *); - if(hx>31]; /* |x|=|y| return x*0*/ - } - - /* determine ix = ilogb(x) */ - if(hx<0x00800000) { /* subnormal x */ - for (ix = -126,i=(hx<<8); i>0; i<<=1) ix -=1; - } else ix = (hx>>23)-127; - - /* determine iy = ilogb(y) */ - if(hy<0x00800000) { /* subnormal y */ - for (iy = -126,i=(hy<<8); i>0; i<<=1) iy -=1; - } else iy = (hy>>23)-127; - - /* set up {hx,lx}, {hy,ly} and align y to x */ - if(ix >= -126) - hx = 0x00800000|(0x007fffff&hx); - else { /* subnormal x, shift x to normal */ - n = -126-ix; - hx <<= n; - } - if(iy >= -126) - hy = 0x00800000|(0x007fffff&hy); - else { /* subnormal y, shift y to normal */ - n = -126-iy; - hy <<= n; - } - - /* fix point fmod */ - n = ix - iy; - q = 0; - while(n--) { - hz=hx-hy; - if(hz<0) hx = hx << 1; - else {hx = hz << 1; q++;} - q <<= 1; - } - hz=hx-hy; - if(hz>=0) {hx=hz;q++;} - - /* convert back to floating value and restore the sign */ - if(hx==0) { /* return sign(x)*0 */ - q &= 0x7fffffff; - *quo = (sxy ? -q : q); - return Zero[(u_int32_t)sx>>31]; - } - while(hx<0x00800000) { /* normalize x */ - hx <<= 1; - iy -= 1; - } - if(iy>= -126) { /* normalize output */ - hx = ((hx-0x00800000)|((iy+127)<<23)); - } else { /* subnormal output */ - n = -126 - iy; - hx >>= n; - } -fixup: - SET_FLOAT_WORD(x,hx); - y = fabsf(y); - if (y < 0x1p-125f) { - if (x+x>y || (x+x==y && (q & 1))) { - q++; - x-=y; - } - } else if (x>0.5f*y || (x==0.5f*y && (q & 1))) { - q++; - x-=y; - } - GET_FLOAT_WORD(hx,x); - SET_FLOAT_WORD(x,hx^sx); - q &= 0x7fffffff; - *quo = (sxy ? -q : q); - return x; -} diff --git a/lib/libc/mingw/math/arm-common/scalbn.c b/lib/libc/mingw/math/arm-common/scalbn.c deleted file mode 100644 index 0e2f14ab7cab..000000000000 --- a/lib/libc/mingw/math/arm-common/scalbn.c +++ /dev/null @@ -1,45 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -double scalbn(double x, int exp) -{ - return x * exp2(exp); -} - -float scalbnf(float x, int exp) -{ - return x * exp2f(exp); -} - -long double scalbnl(long double x, int exp) -{ -#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) - return scalbn(x, exp); -#else -#error Not supported on your platform yet -#endif -} - -double scalbln(double x, long exp) -{ - return x * exp2(exp); -} - -float scalblnf(float x, long exp) -{ - return x * exp2f(exp); -} - -long double scalblnl(long double x, long exp) -{ -#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) - return scalbln(x, exp); -#else -#error Not supported on your platform yet -#endif -} diff --git a/lib/libc/mingw/math/arm/exp2.S b/lib/libc/mingw/math/arm/exp2.S deleted file mode 100644 index 6918ce19dce3..000000000000 --- a/lib/libc/mingw/math/arm/exp2.S +++ /dev/null @@ -1,19 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "exp2.S" - .text - .align 2 - .globl __MINGW_USYMBOL(exp2) - .globl __MINGW_USYMBOL(exp2l) - .def __MINGW_USYMBOL(exp2); .scl 2; .type 32; .endef - .def __MINGW_USYMBOL(exp2l); .scl 2; .type 32; .endef -__MINGW_USYMBOL(exp2): -__MINGW_USYMBOL(exp2l): - vmov.f64 d1, d0 - vmov.f64 d0, #2.0 - b pow diff --git a/lib/libc/mingw/math/arm/exp2f.S b/lib/libc/mingw/math/arm/exp2f.S deleted file mode 100644 index 452cd9a95193..000000000000 --- a/lib/libc/mingw/math/arm/exp2f.S +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "exp2f.S" - .text - .align 2 - .globl __MINGW_USYMBOL(exp2f) - .def __MINGW_USYMBOL(exp2f); .scl 2; .type 32; .endef -__MINGW_USYMBOL(exp2f): - vmov s1, s0 - vmov.f32 s0, #2.0 - b powf diff --git a/lib/libc/mingw/math/arm/nearbyint.S b/lib/libc/mingw/math/arm/nearbyint.S deleted file mode 100644 index 4754d9d66fb7..000000000000 --- a/lib/libc/mingw/math/arm/nearbyint.S +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "nearbyint.S" - .text - .align 4 - .globl __MINGW_USYMBOL(nearbyint) - .def __MINGW_USYMBOL(nearbyint); .scl 2; .type 32; .endef -__MINGW_USYMBOL(nearbyint): - push {r4, lr} - vmrs r4, fpscr - bl rint - vmsr fpscr, r4 - pop {r4, pc} diff --git a/lib/libc/mingw/math/arm/nearbyintf.S b/lib/libc/mingw/math/arm/nearbyintf.S deleted file mode 100644 index 00236cedc9e9..000000000000 --- a/lib/libc/mingw/math/arm/nearbyintf.S +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "nearbyintf.S" - .text - .align 4 - .globl __MINGW_USYMBOL(nearbyintf) - .def __MINGW_USYMBOL(nearbyintf); .scl 2; .type 32; .endef -__MINGW_USYMBOL(nearbyintf): - push {r4, lr} - vmrs r4, fpscr - bl rintf - vmsr fpscr, r4 - pop {r4, pc} diff --git a/lib/libc/mingw/math/arm/nearbyintl.S b/lib/libc/mingw/math/arm/nearbyintl.S deleted file mode 100644 index a552d14e1878..000000000000 --- a/lib/libc/mingw/math/arm/nearbyintl.S +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "nearbyintl.S" - .text - .align 4 - .globl __MINGW_USYMBOL(nearbyintl) - .def __MINGW_USYMBOL(nearbyintl); .scl 2; .type 32; .endef -__MINGW_USYMBOL(nearbyintl): - push {r4, lr} - vmrs r4, fpscr - bl rintl - vmsr fpscr, r4 - pop {r4, pc} diff --git a/lib/libc/mingw/math/arm/s_trunc.c b/lib/libc/mingw/math/arm/s_trunc.c deleted file mode 100644 index a7798df9c7cd..000000000000 --- a/lib/libc/mingw/math/arm/s_trunc.c +++ /dev/null @@ -1,61 +0,0 @@ -/* @(#)s_floor.c 5.1 93/09/24 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include - -/* - * trunc(x) - * Return x rounded toward 0 to integral value - * Method: - * Bit twiddling. - * Exception: - * Inexact flag raised if x not equal to trunc(x). - */ - -#include - -#include "../bsd_private_base.h" - -static const double huge = 1.0e300; - -double -trunc(double x) -{ - int32_t i0,i1,j0; - u_int32_t i; - EXTRACT_WORDS(i0,i1,x); - j0 = ((i0>>20)&0x7ff)-0x3ff; - if(j0<20) { - if(j0<0) { /* raise inexact if x != 0 */ - if(huge+x>0.0) {/* |x|<1, so return 0*sign(x) */ - i0 &= 0x80000000U; - i1 = 0; - } - } else { - i = (0x000fffff)>>j0; - if(((i0&i)|i1)==0) return x; /* x is integral */ - if(huge+x>0.0) { /* raise inexact flag */ - i0 &= (~i); i1=0; - } - } - } else if (j0>51) { - if(j0==0x400) return x+x; /* inf or NaN */ - else return x; /* x is integral */ - } else { - i = ((u_int32_t)(0xffffffff))>>(j0-20); - if((i1&i)==0) return x; /* x is integral */ - if(huge+x>0.0) /* raise inexact flag */ - i1 &= (~i); - } - INSERT_WORDS(x,i0,i1); - return x; -} diff --git a/lib/libc/mingw/math/arm/s_truncf.c b/lib/libc/mingw/math/arm/s_truncf.c deleted file mode 100644 index 8d66c5fbfa08..000000000000 --- a/lib/libc/mingw/math/arm/s_truncf.c +++ /dev/null @@ -1,51 +0,0 @@ -/* @(#)s_floor.c 5.1 93/09/24 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include - -/* - * truncf(x) - * Return x rounded toward 0 to integral value - * Method: - * Bit twiddling. - * Exception: - * Inexact flag raised if x not equal to truncf(x). - */ - -#include "../bsd_private_base.h" - -static const float huge = 1.0e30F; - -float -truncf(float x) -{ - int32_t i0,j0; - u_int32_t i; - GET_FLOAT_WORD(i0,x); - j0 = ((i0>>23)&0xff)-0x7f; - if(j0<23) { - if(j0<0) { /* raise inexact if x != 0 */ - if(huge+x>0.0F) /* |x|<1, so return 0*sign(x) */ - i0 &= 0x80000000; - } else { - i = (0x007fffff)>>j0; - if((i0&i)==0) return x; /* x is integral */ - if(huge+x>0.0F) /* raise inexact flag */ - i0 &= (~i); - } - } else { - if(j0==0x80) return x+x; /* inf or NaN */ - else return x; /* x is integral */ - } - SET_FLOAT_WORD(x,i0); - return x; -} diff --git a/lib/libc/mingw/math/arm64/exp2.S b/lib/libc/mingw/math/arm64/exp2.S deleted file mode 100644 index b1f7a07abd67..000000000000 --- a/lib/libc/mingw/math/arm64/exp2.S +++ /dev/null @@ -1,19 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "exp2.S" - .text - .align 2 - .globl __MINGW_USYMBOL(exp2) - .globl __MINGW_USYMBOL(exp2l) - .def __MINGW_USYMBOL(exp2); .scl 2; .type 32; .endef - .def __MINGW_USYMBOL(exp2l); .scl 2; .type 32; .endef -__MINGW_USYMBOL(exp2): -__MINGW_USYMBOL(exp2l): - fmov d1, d0 - fmov d0, #2.0 - b pow diff --git a/lib/libc/mingw/math/arm64/exp2f.S b/lib/libc/mingw/math/arm64/exp2f.S deleted file mode 100644 index c00f003c7745..000000000000 --- a/lib/libc/mingw/math/arm64/exp2f.S +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "exp2f.S" - .text - .align 2 - .globl __MINGW_USYMBOL(exp2f) - .def __MINGW_USYMBOL(exp2f); .scl 2; .type 32; .endef -__MINGW_USYMBOL(exp2f): - fmov s1, s0 - fmov s0, #2.0 - b powf diff --git a/lib/libc/mingw/math/arm64/nearbyint.S b/lib/libc/mingw/math/arm64/nearbyint.S deleted file mode 100644 index b17ce2bd1dbd..000000000000 --- a/lib/libc/mingw/math/arm64/nearbyint.S +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "nearbyint.S" - .text - .align 2 - .globl __MINGW_USYMBOL(nearbyint) - .def __MINGW_USYMBOL(nearbyint); .scl 2; .type 32; .endef -__MINGW_USYMBOL(nearbyint): - mrs x1, fpcr - frintx d0, d0 - msr fpcr, x1 - ret diff --git a/lib/libc/mingw/math/arm64/nearbyintf.S b/lib/libc/mingw/math/arm64/nearbyintf.S deleted file mode 100644 index 49b6aff11935..000000000000 --- a/lib/libc/mingw/math/arm64/nearbyintf.S +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "nearbyintf.S" - .text - .align 2 - .globl __MINGW_USYMBOL(nearbyintf) - .def __MINGW_USYMBOL(nearbyintf); .scl 2; .type 32; .endef -__MINGW_USYMBOL(nearbyintf): - mrs x1, fpcr - frintx s0, s0 - msr fpcr, x1 - ret diff --git a/lib/libc/mingw/math/arm64/nearbyintl.S b/lib/libc/mingw/math/arm64/nearbyintl.S deleted file mode 100644 index cbfebb250141..000000000000 --- a/lib/libc/mingw/math/arm64/nearbyintl.S +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "nearbyintl.S" - .text - .align 2 - .globl __MINGW_USYMBOL(nearbyintl) - .def __MINGW_USYMBOL(nearbyintl); .scl 2; .type 32; .endef -__MINGW_USYMBOL(nearbyintl): - mrs x1, fpcr - frintx d0, d0 - msr fpcr, x1 - ret diff --git a/lib/libc/mingw/math/arm64/trunc.S b/lib/libc/mingw/math/arm64/trunc.S deleted file mode 100644 index d784bf016351..000000000000 --- a/lib/libc/mingw/math/arm64/trunc.S +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "trunc.S" - .text - .p2align 2 - .globl __MINGW_USYMBOL(trunc) - .def __MINGW_USYMBOL(trunc); .scl 2; .type 32; .endef - -__MINGW_USYMBOL(trunc): - frintz d0, d0 - ret diff --git a/lib/libc/mingw/math/arm64/truncf.S b/lib/libc/mingw/math/arm64/truncf.S deleted file mode 100644 index 22b9ff88c272..000000000000 --- a/lib/libc/mingw/math/arm64/truncf.S +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "truncf.S" - .text - .p2align 2 - .globl __MINGW_USYMBOL(truncf) - .def __MINGW_USYMBOL(truncf); .scl 2; .type 32; .endef - -__MINGW_USYMBOL(truncf): - frintz s0, s0 - ret diff --git a/lib/libc/mingw/math/cbrt.c b/lib/libc/mingw/math/cbrt.c deleted file mode 100644 index 005505235a0a..000000000000 --- a/lib/libc/mingw/math/cbrt.c +++ /dev/null @@ -1,104 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -#include "cephes_mconf.h" - -static const double CBRT2 = 1.2599210498948731647672; -static const double CBRT4 = 1.5874010519681994747517; -static const double CBRT2I = 0.79370052598409973737585; -static const double CBRT4I = 0.62996052494743658238361; - -#ifndef __MINGW32__ -extern double frexp ( double, int * ); -extern double ldexp ( double, int ); -extern int isnan ( double ); -extern int isfinite ( double ); -#endif - -double cbrt(double x) -{ - int e, rem, sign; - double z; - -#ifdef __MINGW32__ - if (!isfinite (x) || x == 0) - return x; -#else -#ifdef NANS - if (isnan(x)) - return x; -#endif -#ifdef INFINITIES - if (!isfinite(x)) - return x; -#endif - if (x == 0) - return (x); -#endif /* __MINGW32__ */ - - if (x > 0) - sign = 1; - else - { - sign = -1; - x = -x; - } - - z = x; - /* extract power of 2, leaving - * mantissa between 0.5 and 1 - */ - x = frexp(x, &e); - - /* Approximate cube root of number between .5 and 1, - * peak relative error = 9.2e-6 - */ - x = (((-1.3466110473359520655053e-1 * x - + 5.4664601366395524503440e-1) * x - - 9.5438224771509446525043e-1) * x - + 1.1399983354717293273738e0 ) * x - + 4.0238979564544752126924e-1; - - /* exponent divided by 3 */ - if (e >= 0) - { - rem = e; - e /= 3; - rem -= 3*e; - if (rem == 1) - x *= CBRT2; - else if (rem == 2) - x *= CBRT4; - } - /* argument less than 1 */ - else - { - e = -e; - rem = e; - e /= 3; - rem -= 3*e; - if (rem == 1) - x *= CBRT2I; - else if (rem == 2) - x *= CBRT4I; - e = -e; - } - - /* multiply by power of 2 */ - x = ldexp(x, e); - - /* Newton iteration */ - x -= ( x - (z/(x*x)) )*0.33333333333333333333; -#ifdef DEC - x -= ( x - (z/(x*x)) )/3.0; -#else - x -= ( x - (z/(x*x)) )*0.33333333333333333333; -#endif - - if (sign < 0) - x = -x; - return (x); -} diff --git a/lib/libc/mingw/math/cbrtf.c b/lib/libc/mingw/math/cbrtf.c deleted file mode 100644 index 1c37e75bc301..000000000000 --- a/lib/libc/mingw/math/cbrtf.c +++ /dev/null @@ -1,75 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -#include "cephes_mconf.h" - -static const float CBRT2 = 1.25992104989487316477; -static const float CBRT4 = 1.58740105196819947475; - -float cbrtf (float x) -{ - int e, rem, sign; - float z; - if (!isfinite (x) || x == 0.0F) - return x; - if (x > 0) - sign = 1; - else - { - sign = -1; - x = -x; - } - - z = x; - /* extract power of 2, leaving - * mantissa between 0.5 and 1 - */ - x = frexpf(x, &e); - - /* Approximate cube root of number between .5 and 1, - * peak relative error = 9.2e-6 - */ - x = (((-0.13466110473359520655053 * x - + 0.54664601366395524503440 ) * x - - 0.95438224771509446525043 ) * x - + 1.1399983354717293273738 ) * x - + 0.40238979564544752126924; - - /* exponent divided by 3 */ - if (e >= 0) - { - rem = e; - e /= 3; - rem -= 3*e; - if (rem == 1) - x *= CBRT2; - else if (rem == 2) - x *= CBRT4; - } -/* argument less than 1 */ - else - { - e = -e; - rem = e; - e /= 3; - rem -= 3*e; - if (rem == 1) - x /= CBRT2; - else if (rem == 2) - x /= CBRT4; - e = -e; - } - - /* multiply by power of 2 */ - x = ldexpf(x, e); - - /* Newton iteration */ - x -= ( x - (z/(x*x)) ) * 0.333333333333; - - if (sign < 0) - x = -x; - return (x); -} diff --git a/lib/libc/mingw/math/copysign.c b/lib/libc/mingw/math/copysign.c deleted file mode 100644 index c3fe76f0d39b..000000000000 --- a/lib/libc/mingw/math/copysign.c +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -typedef union U -{ - unsigned int u[2]; - double d; -} U; - -double copysign(double x, double y) -{ - U h,j; - h.d = x; - j.d = y; - h.u[1] = (h.u[1] & 0x7fffffff) | (j.u[1] & 0x80000000); - return h.d; -} diff --git a/lib/libc/mingw/math/copysignf.c b/lib/libc/mingw/math/copysignf.c deleted file mode 100644 index 0fba92bc7598..000000000000 --- a/lib/libc/mingw/math/copysignf.c +++ /dev/null @@ -1,19 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -typedef union ui_f { - float f; - unsigned int ui; -} ui_f; - -float copysignf(float aX, float aY) -{ - ui_f x,y; - x.f=aX; y.f=aY; - x.ui= (x.ui & 0x7fffffff) | (y.ui & 0x80000000); - return x.f; -} diff --git a/lib/libc/mingw/math/fabs.c b/lib/libc/mingw/math/fabs.c deleted file mode 100644 index a6637114f916..000000000000 --- a/lib/libc/mingw/math/fabs.c +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#define __CRT__NO_INLINE -#include - -double -fabs (double x) -{ -#if defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) - return __builtin_fabs (x); -#elif defined(__i386__) || defined(_X86_) - double res = 0.0; - - asm volatile ("fabs;" : "=t" (res) : "0" (x)); - return res; -#endif /* defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) */ -} diff --git a/lib/libc/mingw/math/fdim.c b/lib/libc/mingw/math/fdim.c deleted file mode 100644 index aec62c4a9c3d..000000000000 --- a/lib/libc/mingw/math/fdim.c +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -#include - -double -fdim (double x, double y) -{ - int cx = fpclassify (x), cy = fpclassify (y); - double r; - - if (cx == FP_NAN || cy == FP_NAN - || (y < 0 && cx == FP_INFINITE && cy == FP_INFINITE)) - return x - y; /* Take care invalid flag is raised. */ - if (x <= y) - return 0.0; - r = x - y; - if (fpclassify (r) == FP_INFINITE) - errno = ERANGE; - return r; -} diff --git a/lib/libc/mingw/math/fdimf.c b/lib/libc/mingw/math/fdimf.c deleted file mode 100644 index 3312a932b047..000000000000 --- a/lib/libc/mingw/math/fdimf.c +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -#include - -float -fdimf (float x, float y) -{ - int cx = fpclassify (x), cy = fpclassify (y); - float r; - - if (cx == FP_NAN || cy == FP_NAN - || (y < 0 && cx == FP_INFINITE && cy == FP_INFINITE)) - return x - y; /* Take care invalid flag is raised. */ - if (x <= y) - return 0.0f; - r = x - y; - if (fpclassify (r) == FP_INFINITE) - errno = ERANGE; - return r; -} diff --git a/lib/libc/mingw/math/fma.c b/lib/libc/mingw/math/fma.c deleted file mode 100644 index 6774be787e62..000000000000 --- a/lib/libc/mingw/math/fma.c +++ /dev/null @@ -1,97 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -double fma(double x, double y, double z); - -#if defined(_ARM_) || defined(__arm__) - -/* Use hardware FMA on ARM. */ -double fma(double x, double y, double z){ - __asm__ ( - "fmacd %0, %1, %2 \n" - : "+w"(z) - : "w"(x), "w"(y) - ); - return z; -} - -#elif defined(_ARM64_) || defined(__aarch64__) - -/* Use hardware FMA on ARM64. */ -double fma(double x, double y, double z){ - __asm__ ( - "fmadd %d0, %d1, %d2, %d0 \n" - : "+w"(z) - : "w"(x), "w"(y) - ); - return z; -} - -#elif defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || defined(__i386__) - -#include -#include - -/* This is in accordance with the IEC 559 double-precision format. - * Be advised that due to the hidden bit, the higher half actually has 26 bits. - * Multiplying two 27-bit numbers will cause a 1-ULP error, which we cannot - * avoid. It is kept in the very last position. - */ -typedef union iec559_double_ { - struct __attribute__((__packed__)) { - uint64_t mlo : 27; - uint64_t mhi : 25; - uint64_t exp : 11; - uint64_t sgn : 1; - }; - double f; -} iec559_double; - -static inline void break_down(iec559_double *restrict lo, iec559_double *restrict hi, double x) { - hi->f = x; - /* Erase low-order significant bits. `hi->f` now has only 26 significant bits. */ - hi->mlo = 0; - /* Store the low-order half. It will be normalized by the hardware. */ - lo->f = x - hi->f; - /* Preserve signness in case of zero. */ - lo->sgn = hi->sgn; -} - -double fma(double x, double y, double z) { - /* - POSIX-2013: - 1. If x or y are NaN, a NaN shall be returned. - 2. If x multiplied by y is an exact infinity and z is also an infinity - but with the opposite sign, a domain error shall occur, and either a NaN - (if supported), or an implementation-defined value shall be returned. - 3. If one of x and y is infinite, the other is zero, and z is not a NaN, - a domain error shall occur, and either a NaN (if supported), or an - implementation-defined value shall be returned. - 4. If one of x and y is infinite, the other is zero, and z is a NaN, a NaN - shall be returned and a domain error may occur. - 5. If x* y is not 0*Inf nor Inf*0 and z is a NaN, a NaN shall be returned. - */ - /* Check whether the result is finite. */ - double ret = x * y + z; - if(!isfinite(ret)) { - return ret; /* If this naive check doesn't yield a finite value, the FMA isn't - likely to return one either. Forward the value as is. */ - } - iec559_double xlo, xhi, ylo, yhi; - break_down(&xlo, &xhi, x); - break_down(&ylo, &yhi, y); - /* The order of these four statements is essential. Don't move them around. */ - ret = z; - ret += xhi.f * yhi.f; /* The most significant item comes first. */ - ret += xhi.f * ylo.f + xlo.f * yhi.f; /* They are equally significant. */ - ret += xlo.f * ylo.f; /* The least significant item comes last. */ - return ret; -} - -#else - -#error Please add FMA implementation for this platform. - -#endif diff --git a/lib/libc/mingw/math/fmaf.c b/lib/libc/mingw/math/fmaf.c deleted file mode 100644 index 4661e4b82955..000000000000 --- a/lib/libc/mingw/math/fmaf.c +++ /dev/null @@ -1,97 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -float fmaf(float x, float y, float z); - -#if defined(_ARM_) || defined(__arm__) - -/* Use hardware FMA on ARM. */ -float fmaf(float x, float y, float z){ - __asm__ ( - "fmacs %0, %1, %2 \n" - : "+t"(z) - : "t"(x), "t"(y) - ); - return z; -} - -#elif defined(_ARM64_) || defined(__aarch64__) - -/* Use hardware FMA on ARM64. */ -float fmaf(float x, float y, float z){ - __asm__ ( - "fmadd %s0, %s1, %s2, %s0 \n" - : "+w"(z) - : "w"(x), "w"(y) - ); - return z; -} - -#elif defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || defined(__i386__) - -#include -#include - -/* This is in accordance with the IEC 559 single-precision format. - * Be advised that due to the hidden bit, the higher half actually has 11 bits. - * Multiplying two 13-bit numbers will cause a 1-ULP error, which we cannot - * avoid. It is kept in the very last position. - */ -typedef union iec559_float_ { - struct __attribute__((__packed__)) { - uint32_t mlo : 13; - uint32_t mhi : 10; - uint32_t exp : 8; - uint32_t sgn : 1; - }; - float f; -} iec559_float; - -static inline void break_down(iec559_float *restrict lo, iec559_float *restrict hi, float x) { - hi->f = x; - /* Erase low-order significant bits. `hi->f` now has only 11 significant bits. */ - hi->mlo = 0; - /* Store the low-order half. It will be normalized by the hardware. */ - lo->f = x - hi->f; - /* Preserve signness in case of zero. */ - lo->sgn = hi->sgn; -} - -float fmaf(float x, float y, float z) { - /* - POSIX-2013: - 1. If x or y are NaN, a NaN shall be returned. - 2. If x multiplied by y is an exact infinity and z is also an infinity - but with the opposite sign, a domain error shall occur, and either a NaN - (if supported), or an implementation-defined value shall be returned. - 3. If one of x and y is infinite, the other is zero, and z is not a NaN, - a domain error shall occur, and either a NaN (if supported), or an - implementation-defined value shall be returned. - 4. If one of x and y is infinite, the other is zero, and z is a NaN, a NaN - shall be returned and a domain error may occur. - 5. If x* y is not 0*Inf nor Inf*0 and z is a NaN, a NaN shall be returned. - */ - /* Check whether the result is finite. */ - float ret = x * y + z; - if(!isfinite(ret)) { - return ret; /* If this naive check doesn't yield a finite value, the FMA isn't - likely to return one either. Forward the value as is. */ - } - iec559_float xlo, xhi, ylo, yhi; - break_down(&xlo, &xhi, x); - break_down(&ylo, &yhi, y); - /* The order of these four statements is essential. Don't move them around. */ - ret = z; - ret += xhi.f * yhi.f; /* The most significant item comes first. */ - ret += xhi.f * ylo.f + xlo.f * yhi.f; /* They are equally significant. */ - ret += xlo.f * ylo.f; /* The least significant item comes last. */ - return ret; -} - -#else - -#error Please add FMA implementation for this platform. - -#endif diff --git a/lib/libc/mingw/math/fmax.c b/lib/libc/mingw/math/fmax.c deleted file mode 100644 index 79f330c49928..000000000000 --- a/lib/libc/mingw/math/fmax.c +++ /dev/null @@ -1,12 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -double -fmax (double _x, double _y) -{ - return ( isgreaterequal (_x, _y)|| __isnan (_y) ? _x : _y ); -} diff --git a/lib/libc/mingw/math/fmaxf.c b/lib/libc/mingw/math/fmaxf.c deleted file mode 100644 index 677a8a735cc1..000000000000 --- a/lib/libc/mingw/math/fmaxf.c +++ /dev/null @@ -1,12 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -float -fmaxf (float _x, float _y) -{ - return (( isgreaterequal(_x, _y) || __isnanf (_y)) ? _x : _y ); -} diff --git a/lib/libc/mingw/math/fmin.c b/lib/libc/mingw/math/fmin.c deleted file mode 100644 index 80695745a978..000000000000 --- a/lib/libc/mingw/math/fmin.c +++ /dev/null @@ -1,12 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -double -fmin (double _x, double _y) -{ - return ((islessequal(_x, _y) || __isnan (_y)) ? _x : _y ); -} diff --git a/lib/libc/mingw/math/fminf.c b/lib/libc/mingw/math/fminf.c deleted file mode 100644 index 2703cb19774c..000000000000 --- a/lib/libc/mingw/math/fminf.c +++ /dev/null @@ -1,12 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -float -fminf (float _x, float _y) -{ - return ((islessequal(_x, _y) || __isnanf (_y)) ? _x : _y ); -} diff --git a/lib/libc/mingw/math/frexp.c b/lib/libc/mingw/math/frexp.c deleted file mode 100644 index 69086daf88bb..000000000000 --- a/lib/libc/mingw/math/frexp.c +++ /dev/null @@ -1,64 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -double frexp(double value, int* exp); - -#if defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__) || \ - defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || defined(__i386__) - -#include - -/* It is assumed that `double` conforms to IEEE 754 and is little-endian. - * This is true on x86 and ARM. */ - -typedef union ieee754_double_ { - struct __attribute__((__packed__)) { - uint64_t f52 : 52; - uint64_t exp : 11; - uint64_t sgn : 1; - }; - double f; -} ieee754_double; - -double frexp(double value, int* exp) -{ - int n; - ieee754_double reg; - reg.f = value; - if(reg.exp == 0x7FF) { - /* The value is an infinity or NaN. - * Store zero in `*exp`. Return the value as is. */ - *exp = 0; - return reg.f; - } - if(reg.exp != 0) { - /* The value is normalized. - * Extract and zero out the exponent. */ - *exp = reg.exp - 0x3FE; - reg.exp = 0x3FE; - return reg.f; - } - if(reg.f52 == 0) { - /* The value is zero. - * Store zero in `*exp`. Return the value as is. - * Note the signness. */ - *exp = 0; - return reg.f; - } - /* The value is denormalized. - * Extract the exponent, normalize the value, then zero out - * the exponent. Note that the hidden bit is removed. */ - n = __builtin_clzll(reg.f52) - 11; - reg.f52 <<= n; - *exp = 1 - 0x3FE - n; - reg.exp = 0x3FE; - return reg.f; -} - -#else - -#error Please add `frexp()` implementation for this platform. - -#endif diff --git a/lib/libc/mingw/math/hypot.c b/lib/libc/mingw/math/hypot.c deleted file mode 100644 index a63c27a687c2..000000000000 --- a/lib/libc/mingw/math/hypot.c +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#define _NEW_COMPLEX_DOUBLE 1 - -#include "../complex/complex_internal.h" -#include -#include - -double hypot (double x, double y) -{ - int x_class = fpclassify (x); - int y_class = fpclassify (y); - - if (x_class == FP_INFINITE || y_class == FP_INFINITE) - return __FLT_HUGE_VAL; - else if (x_class == FP_NAN || y_class == FP_NAN) - return __FLT_NAN; - - return _hypot (x, y); -} - diff --git a/lib/libc/mingw/math/llrint.c b/lib/libc/mingw/math/llrint.c deleted file mode 100644 index 4ba7af7e6b3d..000000000000 --- a/lib/libc/mingw/math/llrint.c +++ /dev/null @@ -1,42 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -#include - -long long llrint (double x) -{ - long long retval = 0ll; -#if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || defined(__i386__) - __asm__ __volatile__ ("fistpll %0" : "=m" (retval) : "t" (x) : "st"); -#else - int mode = fegetround(); - if (mode == FE_DOWNWARD) - retval = (long long)floor(x); - else if (mode == FE_UPWARD) - retval = (long long)ceil(x); - else if (mode == FE_TOWARDZERO) - retval = x >= 0 ? (long long)floor(x) : (long long)ceil(x); - else { - // Break `x` into integral and fractional parts. - double intg, frac; - frac = modf(x, &intg); - frac = fabs(frac); - // Convert the truncated integral part to an integer. - retval = intg; - if (frac < 0.5) { - // Round towards zero. - } else if (frac > 0.5) { - // Round towards infinities. - retval += signbit(x) ? -1 : 1; - } else { - // Round to the nearest even number. - retval += retval % 2; - } - } -#endif - return retval; -} - diff --git a/lib/libc/mingw/math/llrintf.c b/lib/libc/mingw/math/llrintf.c deleted file mode 100644 index e8085ec4ea80..000000000000 --- a/lib/libc/mingw/math/llrintf.c +++ /dev/null @@ -1,41 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -#include - -long long llrintf (float x) -{ - long long retval = 0ll; -#if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || defined(__i386__) - __asm__ __volatile__ ("fistpll %0" : "=m" (retval) : "t" (x) : "st"); -#else - int mode = fegetround(); - if (mode == FE_DOWNWARD) - retval = (long long)floorf(x); - else if (mode == FE_UPWARD) - retval = (long long)ceilf(x); - else if (mode == FE_TOWARDZERO) - retval = x >= 0 ? (long long)floorf(x) : (long long)ceilf(x); - else { - // Break `x` into integral and fractional parts. - float intg, frac; - frac = modff(x, &intg); - frac = fabsf(frac); - // Convert the truncated integral part to an integer. - retval = intg; - if (frac < 0.5) { - // Round towards zero. - } else if (frac > 0.5) { - // Round towards infinities. - retval += signbit(x) ? -1 : 1; - } else { - // Round to the nearest even number. - retval += retval % 2; - } - } -#endif - return retval; -} diff --git a/lib/libc/mingw/math/llround.c b/lib/libc/mingw/math/llround.c deleted file mode 100644 index ef21bcb71c23..000000000000 --- a/lib/libc/mingw/math/llround.c +++ /dev/null @@ -1,38 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -#include -#include - -long long -llround (double x) -{ - double res; - - if (x >= 0.0) - { - res = ceil (x); - if (res - x > 0.5) - res -= 1.0; - } - else - { - res = ceil (-x); - if (res + x > 0.5) - res -= 1.0; - res = -res; - } - if (!isfinite (res) - || res > (double) LONG_LONG_MAX - || res < (double) LONG_LONG_MIN) - { - errno = ERANGE; - /* Undefined behaviour, so we could return anything. */ - /* return res > 0.0 ? LONG_LONG_MAX : LONG_LONG_MIN; */ - } - return (long long) res; -} - diff --git a/lib/libc/mingw/math/llroundf.c b/lib/libc/mingw/math/llroundf.c deleted file mode 100644 index 0a8da174f8d6..000000000000 --- a/lib/libc/mingw/math/llroundf.c +++ /dev/null @@ -1,38 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -#include -#include - -long long -llroundf (float x) -{ - float res; - - if (x >= 0.0F) - { - res = ceilf (x); - if (res - x > 0.5F) - res -= 1.0F; - } - else - { - res = ceilf (-x); - if (res + x > 0.5F) - res -= 1.0F; - res = -res; - } - if (!isfinite (res) - || res > (float) LONG_LONG_MAX - || res < (float) LONG_LONG_MIN) - { - errno = ERANGE; - /* Undefined behaviour, so we could return anything. */ - /* return res > 0.0F ? LONG_LONG_MAX : LONG_LONG_MIN; */ - } - return (long long) res; -} - diff --git a/lib/libc/mingw/math/lrint.c b/lib/libc/mingw/math/lrint.c deleted file mode 100644 index 7831446be6b1..000000000000 --- a/lib/libc/mingw/math/lrint.c +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -#if defined(_AMD64_) || defined(__x86_64__) -#include -#endif - -long lrint (double x) -{ - long retval = 0L; -#if defined(_AMD64_) || defined(__x86_64__) - retval = _mm_cvtsd_si32(_mm_load_sd(&x)); -#elif defined(_X86_) || defined(__i386__) - __asm__ __volatile__ ("fistpl %0" : "=m" (retval) : "t" (x) : "st"); -#elif defined(__arm__) || defined(_ARM_) - float temp; - __asm__ __volatile__ ( - "vcvtr.s32.f64 %[tmp], %[src]\n\t" - "fmrs %[dst], %[tmp]\n\t" - : [dst] "=r" (retval), [tmp] "=t" (temp) : [src] "w" (x)); -#elif defined(__aarch64__) || defined(_ARM64_) - __asm__ __volatile__ ( - "frintx %d1, %d1\n\t" - "fcvtzs %w0, %d1\n\t" - : "=r" (retval), "+w" (x)); -#endif - return retval; -} diff --git a/lib/libc/mingw/math/lrintf.c b/lib/libc/mingw/math/lrintf.c deleted file mode 100644 index 1e8902f031ae..000000000000 --- a/lib/libc/mingw/math/lrintf.c +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -#if defined(_AMD64_) || defined(__x86_64__) -#include -#endif - -long lrintf (float x) -{ - long retval = 0l; -#if defined(_AMD64_) || defined(__x86_64__) - retval = _mm_cvtss_si32(_mm_load_ss(&x)); -#elif defined(_X86_) || defined(__i386__) - __asm__ __volatile__ ("fistpl %0" : "=m" (retval) : "t" (x) : "st"); -#elif defined(__arm__) || defined(_ARM_) - __asm__ __volatile__ ( - "vcvtr.s32.f32 %[src], %[src]\n\t" - "fmrs %[dst], %[src]\n\t" - : [dst] "=r" (retval), [src] "+w" (x)); -#elif defined(__aarch64__) || defined(_ARM64_) - __asm__ __volatile__ ( - "frintx %s1, %s1\n\t" - "fcvtzs %w0, %s1\n\t" - : "=r" (retval), "+w" (x)); -#endif - return retval; -} diff --git a/lib/libc/mingw/math/lround.c b/lib/libc/mingw/math/lround.c deleted file mode 100644 index 560ef614f5b6..000000000000 --- a/lib/libc/mingw/math/lround.c +++ /dev/null @@ -1,37 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -#include -#include - -long -lround (double x) -{ - double res; - - if (x >= 0.0) - { - res = ceil (x); - if (res - x > 0.5) - res -= 1.0; - } - else - { - res = ceil (-x); - if (res + x > 0.5) - res -= 1.0; - res = -res; - } - if (!isfinite (res) - || res > (double) LONG_MAX - || res < (double) LONG_MIN) - { - errno = ERANGE; - /* Undefined behaviour, so we could return anything. */ - /* return res > 0.0 ? LONG_MAX : LONG_MIN; */ - } - return (long) res; -} diff --git a/lib/libc/mingw/math/lroundf.c b/lib/libc/mingw/math/lroundf.c deleted file mode 100644 index 04a9354f3b6f..000000000000 --- a/lib/libc/mingw/math/lroundf.c +++ /dev/null @@ -1,37 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -#include -#include - -long -lroundf (float x) -{ - float res; - - if (x >= 0.0F) - { - res = ceilf (x); - if (res - x > 0.5F) - res -= 1.0F; - } - else - { - res = ceilf (-x); - if (res + x > 0.5F) - res -= 1.0F; - res = -res; - } - if (!isfinite (res) - || res > (float) LONG_MAX - || res < (float) LONG_MIN) - { - errno = ERANGE; - /* Undefined behaviour, so we could return anything. */ - /* return res > 0.0F ? LONG_MAX : LONG_MIN; */ - } - return (long) res; -} diff --git a/lib/libc/mingw/math/modf.c b/lib/libc/mingw/math/modf.c deleted file mode 100644 index d2623095c128..000000000000 --- a/lib/libc/mingw/math/modf.c +++ /dev/null @@ -1,41 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -#include -#include - -double -modf (double value, double* iptr) -{ - double int_part = 0.0; - /* truncate */ -#if defined(_AMD64_) || defined(__x86_64__) - asm volatile ("subq $8, %%rsp\n" - "fnstcw 4(%%rsp)\n" - "movzwl 4(%%rsp), %%eax\n" - "orb $12, %%ah\n" - "movw %%ax, (%%rsp)\n" - "fldcw (%%rsp)\n" - "frndint\n" - "fldcw 4(%%rsp)\n" - "addq $8, %%rsp\n" : "=t" (int_part) : "0" (value) : "eax"); /* round */ -#elif defined(_X86_) || defined(__i386__) - asm volatile ("push %%eax\n\tsubl $8, %%esp\n" - "fnstcw 4(%%esp)\n" - "movzwl 4(%%esp), %%eax\n" - "orb $12, %%ah\n" - "movw %%ax, (%%esp)\n" - "fldcw (%%esp)\n" - "frndint\n" - "fldcw 4(%%esp)\n" - "addl $8, %%esp\n\tpop %%eax\n" : "=t" (int_part) : "0" (value) : "eax"); /* round */ -#else - int_part = trunc(value); -#endif - if (iptr) - *iptr = int_part; - return (isinf (value) ? 0.0 : value - int_part); -} diff --git a/lib/libc/mingw/math/nextafterf.c b/lib/libc/mingw/math/nextafterf.c deleted file mode 100644 index 143a35d0a81f..000000000000 --- a/lib/libc/mingw/math/nextafterf.c +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -float -nextafterf (float x, float y) -{ - union - { - float f; - unsigned int i; - } u; - if (isnan (y) || isnan (x)) - return x + y; - if (x == y ) - /* nextafter (0.0, -O.0) should return -0.0. */ - return y; - u.f = x; - if (x == 0.0F) - { - u.i = 1; - return y > 0.0F ? u.f : -u.f; - } - if (((x > 0.0F) ^ (y > x)) == 0) - u.i++; - else - u.i--; - return u.f; -} diff --git a/lib/libc/mingw/math/round.c b/lib/libc/mingw/math/round.c deleted file mode 100644 index aecf1d84bc93..000000000000 --- a/lib/libc/mingw/math/round.c +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -double -round (double x) -{ - double res; - if (x >= 0.0) - { - res = ceil (x); - if (res - x > 0.5) - res -= 1.0; - } - else - { - res = ceil (-x); - if (res + x > 0.5) - res -= 1.0; - res = -res; - } - return res; -} diff --git a/lib/libc/mingw/math/roundf.c b/lib/libc/mingw/math/roundf.c deleted file mode 100644 index 2b954274294e..000000000000 --- a/lib/libc/mingw/math/roundf.c +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -float -roundf (float x) -{ - float res; - if (x >= 0.0F) - { - res = ceilf (x); - if (res - x > 0.5F) - res -= 1.0F; - } - else - { - res = ceilf (-x); - if (res + x > 0.5F) - res -= 1.0F; - res = -res; - } - return res; -} diff --git a/lib/libc/mingw/math/s_erf.c b/lib/libc/mingw/math/s_erf.c deleted file mode 100644 index e65409b8b4e3..000000000000 --- a/lib/libc/mingw/math/s_erf.c +++ /dev/null @@ -1,347 +0,0 @@ -/* @(#)s_erf.c 1.3 95/01/18 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* double erf(double x) - * double erfc(double x) - * x - * 2 |\ - * erf(x) = --------- | exp(-t*t)dt - * sqrt(pi) \| - * 0 - * - * erfc(x) = 1-erf(x) - * Note that - * erf(-x) = -erf(x) - * erfc(-x) = 2 - erfc(x) - * - * Method: - * 1. For |x| in [0, 0.84375] - * erf(x) = x + x*R(x^2) - * erfc(x) = 1 - erf(x) if x in [-.84375,0.25] - * = 0.5 + ((0.5-x)-x*R) if x in [0.25,0.84375] - * where R = P/Q where P is an odd poly of degree 8 and - * Q is an odd poly of degree 10. - * -57.90 - * | R - (erf(x)-x)/x | <= 2 - * - * Remark. The formula is derived by noting - * erf(x) = (2/sqrt(pi))*(x - x^3/3 + x^5/10 - x^7/42 + ....) - * and that - * 2/sqrt(pi) = 1.128379167095512573896158903121545171688 - * is close to one. The interval is chosen because the fix - * point of erf(x) is near 0.6174 (i.e., erf(x)=x when x is - * near 0.6174), and by some experiment, 0.84375 is chosen to - * guarantee the error is less than one ulp for erf. - * - * 2. For |x| in [0.84375,1.25], let s = |x| - 1, and - * c = 0.84506291151 rounded to single (24 bits) - * erf(x) = sign(x) * (c + P1(s)/Q1(s)) - * erfc(x) = (1-c) - P1(s)/Q1(s) if x > 0 - * 1+(c+P1(s)/Q1(s)) if x < 0 - * |P1/Q1 - (erf(|x|)-c)| <= 2**-59.06 - * Remark: here we use the taylor series expansion at x=1. - * erf(1+s) = erf(1) + s*Poly(s) - * = 0.845.. + P1(s)/Q1(s) - * That is, we use rational approximation to approximate - * erf(1+s) - (c = (single)0.84506291151) - * Note that |P1/Q1|< 0.078 for x in [0.84375,1.25] - * where - * P1(s) = degree 6 poly in s - * Q1(s) = degree 6 poly in s - * - * 3. For x in [1.25,1/0.35(~2.857143)], - * erfc(x) = (1/x)*exp(-x*x-0.5625+R1/S1) - * erf(x) = 1 - erfc(x) - * where - * R1(z) = degree 7 poly in z, (z=1/x^2) - * S1(z) = degree 8 poly in z - * - * 4. For x in [1/0.35,28] - * erfc(x) = (1/x)*exp(-x*x-0.5625+R2/S2) if x > 0 - * = 2.0 - (1/x)*exp(-x*x-0.5625+R2/S2) if -6 x >= 28 - * erf(x) = sign(x) *(1 - tiny) (raise inexact) - * erfc(x) = tiny*tiny (raise underflow) if x > 0 - * = 2 - tiny if x<0 - * - * 7. Special case: - * erf(0) = 0, erf(inf) = 1, erf(-inf) = -1, - * erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2, - * erfc/erf(NaN) is NaN - */ - - -/* #include "fdlibm.h" */ - -#include -#include -#include - -#define __ieee754_exp exp - -typedef union -{ - double value; - struct - { - uint32_t lsw; - uint32_t msw; - } parts; -} ieee_double_shape_type; - - -static inline int __get_hi_word(const double x) -{ - ieee_double_shape_type u; - u.value = x; - return u.parts.msw; -} - -static inline void __trunc_lo_word(double *x) -{ - ieee_double_shape_type u; - u.value = *x; - u.parts.lsw = 0; - *x = u.value; -} - - -static const double - tiny= 1e-300, - half= 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ - one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ - two = 2.00000000000000000000e+00, /* 0x40000000, 0x00000000 */ - /* c = (float)0.84506291151 */ - erx = 8.45062911510467529297e-01, /* 0x3FEB0AC1, 0x60000000 */ - /* - * Coefficients for approximation to erf on [0,0.84375] - */ - efx = 1.28379167095512586316e-01, /* 0x3FC06EBA, 0x8214DB69 */ - efx8= 1.02703333676410069053e+00, /* 0x3FF06EBA, 0x8214DB69 */ - pp0 = 1.28379167095512558561e-01, /* 0x3FC06EBA, 0x8214DB68 */ - pp1 = -3.25042107247001499370e-01, /* 0xBFD4CD7D, 0x691CB913 */ - pp2 = -2.84817495755985104766e-02, /* 0xBF9D2A51, 0xDBD7194F */ - pp3 = -5.77027029648944159157e-03, /* 0xBF77A291, 0x236668E4 */ - pp4 = -2.37630166566501626084e-05, /* 0xBEF8EAD6, 0x120016AC */ - qq1 = 3.97917223959155352819e-01, /* 0x3FD97779, 0xCDDADC09 */ - qq2 = 6.50222499887672944485e-02, /* 0x3FB0A54C, 0x5536CEBA */ - qq3 = 5.08130628187576562776e-03, /* 0x3F74D022, 0xC4D36B0F */ - qq4 = 1.32494738004321644526e-04, /* 0x3F215DC9, 0x221C1A10 */ - qq5 = -3.96022827877536812320e-06, /* 0xBED09C43, 0x42A26120 */ - /* - * Coefficients for approximation to erf in [0.84375,1.25] - */ - pa0 = -2.36211856075265944077e-03, /* 0xBF6359B8, 0xBEF77538 */ - pa1 = 4.14856118683748331666e-01, /* 0x3FDA8D00, 0xAD92B34D */ - pa2 = -3.72207876035701323847e-01, /* 0xBFD7D240, 0xFBB8C3F1 */ - pa3 = 3.18346619901161753674e-01, /* 0x3FD45FCA, 0x805120E4 */ - pa4 = -1.10894694282396677476e-01, /* 0xBFBC6398, 0x3D3E28EC */ - pa5 = 3.54783043256182359371e-02, /* 0x3FA22A36, 0x599795EB */ - pa6 = -2.16637559486879084300e-03, /* 0xBF61BF38, 0x0A96073F */ - qa1 = 1.06420880400844228286e-01, /* 0x3FBB3E66, 0x18EEE323 */ - qa2 = 5.40397917702171048937e-01, /* 0x3FE14AF0, 0x92EB6F33 */ - qa3 = 7.18286544141962662868e-02, /* 0x3FB2635C, 0xD99FE9A7 */ - qa4 = 1.26171219808761642112e-01, /* 0x3FC02660, 0xE763351F */ - qa5 = 1.36370839120290507362e-02, /* 0x3F8BEDC2, 0x6B51DD1C */ - qa6 = 1.19844998467991074170e-02, /* 0x3F888B54, 0x5735151D */ - /* - * Coefficients for approximation to erfc in [1.25,1/0.35] - */ - ra0 = -9.86494403484714822705e-03, /* 0xBF843412, 0x600D6435 */ - ra1 = -6.93858572707181764372e-01, /* 0xBFE63416, 0xE4BA7360 */ - ra2 = -1.05586262253232909814e+01, /* 0xC0251E04, 0x41B0E726 */ - ra3 = -6.23753324503260060396e+01, /* 0xC04F300A, 0xE4CBA38D */ - ra4 = -1.62396669462573470355e+02, /* 0xC0644CB1, 0x84282266 */ - ra5 = -1.84605092906711035994e+02, /* 0xC067135C, 0xEBCCABB2 */ - ra6 = -8.12874355063065934246e+01, /* 0xC0545265, 0x57E4D2F2 */ - ra7 = -9.81432934416914548592e+00, /* 0xC023A0EF, 0xC69AC25C */ - sa1 = 1.96512716674392571292e+01, /* 0x4033A6B9, 0xBD707687 */ - sa2 = 1.37657754143519042600e+02, /* 0x4061350C, 0x526AE721 */ - sa3 = 4.34565877475229228821e+02, /* 0x407B290D, 0xD58A1A71 */ - sa4 = 6.45387271733267880336e+02, /* 0x40842B19, 0x21EC2868 */ - sa5 = 4.29008140027567833386e+02, /* 0x407AD021, 0x57700314 */ - sa6 = 1.08635005541779435134e+02, /* 0x405B28A3, 0xEE48AE2C */ - sa7 = 6.57024977031928170135e+00, /* 0x401A47EF, 0x8E484A93 */ - sa8 = -6.04244152148580987438e-02, /* 0xBFAEEFF2, 0xEE749A62 */ - /* - * Coefficients for approximation to erfc in [1/.35,28] - */ - rb0 = -9.86494292470009928597e-03, /* 0xBF843412, 0x39E86F4A */ - rb1 = -7.99283237680523006574e-01, /* 0xBFE993BA, 0x70C285DE */ - rb2 = -1.77579549177547519889e+01, /* 0xC031C209, 0x555F995A */ - rb3 = -1.60636384855821916062e+02, /* 0xC064145D, 0x43C5ED98 */ - rb4 = -6.37566443368389627722e+02, /* 0xC083EC88, 0x1375F228 */ - rb5 = -1.02509513161107724954e+03, /* 0xC0900461, 0x6A2E5992 */ - rb6 = -4.83519191608651397019e+02, /* 0xC07E384E, 0x9BDC383F */ - sb1 = 3.03380607434824582924e+01, /* 0x403E568B, 0x261D5190 */ - sb2 = 3.25792512996573918826e+02, /* 0x40745CAE, 0x221B9F0A */ - sb3 = 1.53672958608443695994e+03, /* 0x409802EB, 0x189D5118 */ - sb4 = 3.19985821950859553908e+03, /* 0x40A8FFB7, 0x688C246A */ - sb5 = 2.55305040643316442583e+03, /* 0x40A3F219, 0xCEDF3BE6 */ - sb6 = 4.74528541206955367215e+02, /* 0x407DA874, 0xE79FE763 */ - sb7 = -2.24409524465858183362e+01; /* 0xC03670E2, 0x42712D62 */ - - -double erf(double x) -{ - int hx, ix, i; - double R, S, P, Q, s, y, z, r; - hx = __get_hi_word(x); - ix = hx & 0x7fffffff; - if (ix >= 0x7ff00000) { /* erf(nan)=nan */ - i = ((unsigned)hx>>31)<<1; - return (double)(1-i)+one/x; /* erf(+-inf)=+-1 */ - } - - if (ix < 0x3feb0000) { /* |x|<0.84375 */ - if (ix < 0x3e300000) { /* |x|<2**-28 */ - if (ix < 0x00800000) - return 0.125*(8.0*x+efx8*x); /*avoid underflow */ - return x + efx*x; - } - z = x*x; - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); - s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); - y = r/s; - return x + x*y; - } - if (ix < 0x3ff40000) { /* 0.84375 <= |x| < 1.25 */ - s = fabs(x)-one; - P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); - Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); - if (hx >= 0) - return erx + P/Q; - else - return -erx - P/Q; - } - if (ix >= 0x40180000) { /* inf>|x|>=6 */ - if (hx >= 0) - return one-tiny; - else - return tiny-one; - } - x = fabs(x); - s = one/(x*x); - if (ix < 0x4006DB6E) { /* |x| < 1/0.35 */ - R = ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( - ra5+s*(ra6+s*ra7)))))); - S = one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( - sa5+s*(sa6+s*(sa7+s*sa8))))))); - } else { /* |x| >= 1/0.35 */ - R = rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( - rb5+s*rb6))))); - S = one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( - sb5+s*(sb6+s*sb7)))))); - } - z = x; - __trunc_lo_word(&z); - r = __ieee754_exp(-z*z-0.5625)*__ieee754_exp((z-x)*(z+x)+R/S); - if (hx >= 0) - return one-r/x; - else - return r/x-one; -} - -double erfc(double x) -{ - int hx,ix; - double R,S,P,Q,s,y,z,r; - hx = __get_hi_word(x); - ix = hx&0x7fffffff; - if (ix >= 0x7ff00000) { /* erfc(nan)=nan */ - /* erfc(+-inf)=0,2 */ - return (double)(((unsigned)hx>>31)<<1)+one/x; - } - - if (ix < 0x3feb0000) { /* |x|<0.84375 */ - if (ix < 0x3c700000) /* |x|<2**-56 */ - return one-x; - z = x*x; - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); - s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); - y = r/s; - if (hx < 0x3fd00000) { /* x<1/4 */ - return one-(x+x*y); - } else { - r = x*y; - r += (x-half); - return half - r ; - } - } - if (ix < 0x3ff40000) { /* 0.84375 <= |x| < 1.25 */ - s = fabs(x)-one; - P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); - Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); - if (hx >= 0) { - z = one-erx; return z - P/Q; - } else { - z = erx+P/Q; return one+z; - } - } - if (ix < 0x403c0000) { /* |x|<28 */ - x = fabs(x); - s = one/(x*x); - if (ix < 0x4006DB6D) { /* |x| < 1/.35 ~ 2.857143*/ - R = ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( - ra5+s*(ra6+s*ra7)))))); - S = one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( - sa5+s*(sa6+s*(sa7+s*sa8))))))); - } else { /* |x| >= 1/.35 ~ 2.857143 */ - if (hx < 0 && ix >= 0x40180000) - return two-tiny; /* x < -6 */ - R = rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( - rb5+s*rb6))))); - S = one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( - sb5+s*(sb6+s*sb7)))))); - } - z = x; - __trunc_lo_word(&z); - r = __ieee754_exp(-z*z-0.5625)* - __ieee754_exp((z-x)*(z+x)+R/S); - if (hx > 0) - return r/x; - else - return two-r/x; - } else { - /* set range error */ - errno = ERANGE; - if (hx > 0) - return tiny*tiny; - else - return two-tiny; - } -} - diff --git a/lib/libc/mingw/math/sf_erf.c b/lib/libc/mingw/math/sf_erf.c deleted file mode 100644 index 1e1997b3c12e..000000000000 --- a/lib/libc/mingw/math/sf_erf.c +++ /dev/null @@ -1,268 +0,0 @@ -/* sf_erf.c -- float version of s_erf.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* -#include "fdlibm.h" -*/ -#include -#include -#include - -#define __ieee754_expf expf - -typedef union -{ - float value; - uint32_t word; -} ieee_float_shape_type; - -/* Get a 32 bit int from a float. */ - -static inline int -__get_float_word(float d) -{ - ieee_float_shape_type u; - u.value = d; - return u.word; -} - -/* Set a float from a 32 bit int. */ - -#define SET_FLOAT_WORD(d,i) \ -do { \ - ieee_float_shape_type sf_u; \ - sf_u.word = (i); \ - (d) = sf_u.value; \ -} while (0) - -static inline void __trunc_float_word(float * x) -{ - ieee_float_shape_type u; - u.value = * x; - u.word &= 0xfffff000; -} - -#ifdef __v810__ -#define const -#endif - -static const float - tiny= 1e-30, - half= 5.0000000000e-01, /* 0x3F000000 */ - one = 1.0000000000e+00, /* 0x3F800000 */ - two = 2.0000000000e+00, /* 0x40000000 */ - /* c = (subfloat)0.84506291151 */ - erx = 8.4506291151e-01, /* 0x3f58560b */ - /* - * Coefficients for approximation to erf on [0,0.84375] - */ - efx = 1.2837916613e-01, /* 0x3e0375d4 */ - efx8= 1.0270333290e+00, /* 0x3f8375d4 */ - pp0 = 1.2837916613e-01, /* 0x3e0375d4 */ - pp1 = -3.2504209876e-01, /* 0xbea66beb */ - pp2 = -2.8481749818e-02, /* 0xbce9528f */ - pp3 = -5.7702702470e-03, /* 0xbbbd1489 */ - pp4 = -2.3763017452e-05, /* 0xb7c756b1 */ - qq1 = 3.9791721106e-01, /* 0x3ecbbbce */ - qq2 = 6.5022252500e-02, /* 0x3d852a63 */ - qq3 = 5.0813062117e-03, /* 0x3ba68116 */ - qq4 = 1.3249473704e-04, /* 0x390aee49 */ - qq5 = -3.9602282413e-06, /* 0xb684e21a */ - /* - * Coefficients for approximation to erf in [0.84375,1.25] - */ - pa0 = -2.3621185683e-03, /* 0xbb1acdc6 */ - pa1 = 4.1485610604e-01, /* 0x3ed46805 */ - pa2 = -3.7220788002e-01, /* 0xbebe9208 */ - pa3 = 3.1834661961e-01, /* 0x3ea2fe54 */ - pa4 = -1.1089469492e-01, /* 0xbde31cc2 */ - pa5 = 3.5478305072e-02, /* 0x3d1151b3 */ - pa6 = -2.1663755178e-03, /* 0xbb0df9c0 */ - qa1 = 1.0642088205e-01, /* 0x3dd9f331 */ - qa2 = 5.4039794207e-01, /* 0x3f0a5785 */ - qa3 = 7.1828655899e-02, /* 0x3d931ae7 */ - qa4 = 1.2617121637e-01, /* 0x3e013307 */ - qa5 = 1.3637083583e-02, /* 0x3c5f6e13 */ - qa6 = 1.1984500103e-02, /* 0x3c445aa3 */ - /* - * Coefficients for approximation to erfc in [1.25,1/0.35] - */ - ra0 = -9.8649440333e-03, /* 0xbc21a093 */ - ra1 = -6.9385856390e-01, /* 0xbf31a0b7 */ - ra2 = -1.0558626175e+01, /* 0xc128f022 */ - ra3 = -6.2375331879e+01, /* 0xc2798057 */ - ra4 = -1.6239666748e+02, /* 0xc322658c */ - ra5 = -1.8460508728e+02, /* 0xc3389ae7 */ - ra6 = -8.1287437439e+01, /* 0xc2a2932b */ - ra7 = -9.8143291473e+00, /* 0xc11d077e */ - sa1 = 1.9651271820e+01, /* 0x419d35ce */ - sa2 = 1.3765776062e+02, /* 0x4309a863 */ - sa3 = 4.3456588745e+02, /* 0x43d9486f */ - sa4 = 6.4538726807e+02, /* 0x442158c9 */ - sa5 = 4.2900814819e+02, /* 0x43d6810b */ - sa6 = 1.0863500214e+02, /* 0x42d9451f */ - sa7 = 6.5702495575e+00, /* 0x40d23f7c */ - sa8 = -6.0424413532e-02, /* 0xbd777f97 */ - /* - * Coefficients for approximation to erfc in [1/.35,28] - */ - rb0 = -9.8649431020e-03, /* 0xbc21a092 */ - rb1 = -7.9928326607e-01, /* 0xbf4c9dd4 */ - rb2 = -1.7757955551e+01, /* 0xc18e104b */ - rb3 = -1.6063638306e+02, /* 0xc320a2ea */ - rb4 = -6.3756646729e+02, /* 0xc41f6441 */ - rb5 = -1.0250950928e+03, /* 0xc480230b */ - rb6 = -4.8351919556e+02, /* 0xc3f1c275 */ - sb1 = 3.0338060379e+01, /* 0x41f2b459 */ - sb2 = 3.2579251099e+02, /* 0x43a2e571 */ - sb3 = 1.5367296143e+03, /* 0x44c01759 */ - sb4 = 3.1998581543e+03, /* 0x4547fdbb */ - sb5 = 2.5530502930e+03, /* 0x451f90ce */ - sb6 = 4.7452853394e+02, /* 0x43ed43a7 */ - sb7 = -2.2440952301e+01; /* 0xc1b38712 */ - -float erff(float x) -{ - int32_t hx, ix, i; - float R, S, P, Q, s, y, z, r; - hx = __get_float_word(x); - ix = hx & 0x7fffffff; - if (!(ix<0x7f800000L)) { /* erf(nan)=nan */ - i = ((uint32_t)hx>>31)<<1; - return (float)(1-i)+one/x; /* erf(+-inf)=+-1 */ - } - - if (ix < 0x3f580000) { /* |x|<0.84375 */ - if (ix < 0x31800000) { /* |x|<2**-28 */ - if (ix < 0x04000000) - /*avoid underflow */ - return (float)0.125*((float)8.0*x+efx8*x); - return x + efx*x; - } - z = x*x; - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); - s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); - y = r/s; - return x + x*y; - } - if (ix < 0x3fa00000) { /* 0.84375 <= |x| < 1.25 */ - s = fabsf(x)-one; - P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); - Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); - if (hx >= 0) - return erx + P/Q; - else - return -erx - P/Q; - } - if (ix >= 0x40c00000) { /* inf>|x|>=6 */ - if (hx >= 0) - return one-tiny; - else - return tiny-one; - } - x = fabsf(x); - s = one/(x*x); - if (ix< 0x4036DB6E) { /* |x| < 1/0.35 */ - R = ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( - ra5+s*(ra6+s*ra7)))))); - S = one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( - sa5+s*(sa6+s*(sa7+s*sa8))))))); - } else { /* |x| >= 1/0.35 */ - R = rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( - rb5+s*rb6))))); - S = one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( - sb5+s*(sb6+s*sb7)))))); - } - - z = x; - __trunc_float_word (&z); - r = __ieee754_expf(-z*z-(float)0.5625)*__ieee754_expf((z-x)*(z+x)+R/S); - if (hx >= 0) - return one-r/x; - else - return r/x-one; -} - -float erfcf(float x) -{ - int32_t hx, ix; - float R, S, P, Q, s, y, z, r; - hx = __get_float_word(x); - ix = hx & 0x7fffffff; - if (!(ix < 0x7f800000L)) { /* erfc(nan)=nan */ - /* erfc(+-inf)=0,2 */ - return (float)(((uint32_t)hx>>31)<<1)+one/x; - } - - if (ix < 0x3f580000) { /* |x|<0.84375 */ - if (ix < 0x23800000) /* |x|<2**-56 */ - return one-x; - z = x*x; - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); - s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); - y = r/s; - if (hx < 0x3e800000) { /* x<1/4 */ - return one-(x+x*y); - } else { - r = x*y; - r += (x-half); - return half - r ; - } - } - if (ix < 0x3fa00000) { /* 0.84375 <= |x| < 1.25 */ - s = fabsf(x)-one; - P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); - Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); - if (hx >= 0) { - z = one-erx; return z - P/Q; - } else { - z = erx+P/Q; return one+z; - } - } - - if (ix < 0x41e00000) { /* |x|<28 */ - x = fabsf(x); - s = one/(x*x); - if (ix< 0x4036DB6D) { /* |x| < 1/.35 ~ 2.857143*/ - R = ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( - ra5+s*(ra6+s*ra7)))))); - S = one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( - sa5+s*(sa6+s*(sa7+s*sa8))))))); - } else { /* |x| >= 1/.35 ~ 2.857143 */ - if (hx < 0 && ix >= 0x40c00000) - return two-tiny;/* x < -6 */ - R = rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( - rb5+s*rb6))))); - S = one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( - sb5+s*(sb6+s*sb7)))))); - } - - z = x; - __trunc_float_word (&z); - r = __ieee754_expf(-z*z-(float)0.5625)* - __ieee754_expf((z-x)*(z+x)+R/S); - if (hx > 0) - return r/x; - else - return two-r/x; - } else { - /* set range error */ - errno = ERANGE; - if (hx > 0) - return tiny*tiny; - else - return two-tiny; - } -} diff --git a/lib/libc/mingw/math/sqrt.c b/lib/libc/mingw/math/sqrt.c deleted file mode 100644 index 7c854816c493..000000000000 --- a/lib/libc/mingw/math/sqrt.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - This Software is provided under the Zope Public License (ZPL) Version 2.1. - - Copyright (c) 2009, 2010 by the mingw-w64 project - - See the AUTHORS file for the list of contributors to the mingw-w64 project. - - This license has been certified as open source. It has also been designated - as GPL compatible by the Free Software Foundation (FSF). - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions in source code must retain the accompanying copyright - notice, this list of conditions, and the following disclaimer. - 2. Redistributions in binary form must reproduce the accompanying - copyright notice, this list of conditions, and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - 3. Names of the copyright holders must not be used to endorse or promote - products derived from this software without prior written permission - from the copyright holders. - 4. The right to distribute this software or to use it for any purpose does - not give you the right to use Servicemarks (sm) or Trademarks (tm) of - the copyright holders. Use of them is covered by separate agreement - with the copyright holders. - 5. If any files are modified, you must cause the modified files to carry - prominent notices stating that you changed the files and the date of - any change. - - Disclaimer - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define _NEW_COMPLEX_DOUBLE 1 -#define X64_ASM "sqrtsd" -#include "sqrt.def.h" diff --git a/lib/libc/mingw/math/tgamma.c b/lib/libc/mingw/math/tgamma.c deleted file mode 100644 index f652d80a36c7..000000000000 --- a/lib/libc/mingw/math/tgamma.c +++ /dev/null @@ -1,268 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include "cephes_mconf.h" - -#ifdef UNK -static const uD P[7] = { - { { 1.60119522476751861407E-4 } }, - { { 1.19135147006586384913E-3 } }, - { { 1.04213797561761569935E-2 } }, - { { 4.76367800457137231464E-2 } }, - { { 2.07448227648435975150E-1 } }, - { { 4.94214826801497100753E-1 } }, - { { 9.99999999999999996796E-1 } } -}; -static const uD Q[8] = { - { { -2.31581873324120129819E-5 } }, - { { 5.39605580493303397842E-4 } }, - { { -4.45641913851797240494E-3 } }, - { { 1.18139785222060435552E-2 } }, - { { 3.58236398605498653373E-2 } }, - { { -2.34591795718243348568E-1 } }, - { { 7.14304917030273074085E-2 } }, - { { 1.00000000000000000320E0 } } -}; -#define MAXGAM 171.624376956302725 -static const double LOGPI = 1.14472988584940017414; -#endif - -#ifdef IBMPC -static const uD P[7] = { - { { 0x2153,0x3998,0xfcb8,0x3f24 } }, - { { 0xbfab,0xe686,0x84e3,0x3f53 } }, - { { 0x14b0,0xe9db,0x57cd,0x3f85 } }, - { { 0x23d3,0x18c4,0x63d9,0x3fa8 } }, - { { 0x7d31,0xdcae,0x8da9,0x3fca } }, - { { 0xe312,0x3993,0xa137,0x3fdf } }, - { { 0x0000,0x0000,0x0000,0x3ff0 } } -}; -static const uD Q[8] = { - { { 0xd3af,0x8400,0x487a,0xbef8 } }, - { { 0x2573,0x2915,0xae8a,0x3f41 } }, - { { 0xb44a,0xe750,0x40e4,0xbf72 } }, - { { 0xb117,0x5b1b,0x31ed,0x3f88 } }, - { { 0xde67,0xe33f,0x5779,0x3fa2 } }, - { { 0x87c2,0x9d42,0x071a,0xbfce } }, - { { 0x3c51,0xc9cd,0x4944,0x3fb2 } }, - { { 0x0000,0x0000,0x0000,0x3ff0 } } -}; -#define MAXGAM 171.624376956302725 -#endif - -#ifdef MIEEE -static const uD P[7] = { - { { 0x3f24,0xfcb8,0x3998,0x2153 } }, - { { 0x3f53,0x84e3,0xe686,0xbfab } }, - { { 0x3f85,0x57cd,0xe9db,0x14b0 } }, - { { 0x3fa8,0x63d9,0x18c4,0x23d3 } }, - { { 0x3fca,0x8da9,0xdcae,0x7d31 } }, - { { 0x3fdf,0xa137,0x3993,0xe312 } }, - { { 0x3ff0,0x0000,0x0000,0x0000 } } -}; -static const unsigned short Q[8] = { - { { 0xbef8,0x487a,0x8400,0xd3af } }, - { { 0x3f41,0xae8a,0x2915,0x2573 } }, - { { 0xbf72,0x40e4,0xe750,0xb44a } }, - { { 0x3f88,0x31ed,0x5b1b,0xb117 } }, - { { 0x3fa2,0x5779,0xe33f,0xde67 } }, - { { 0xbfce,0x071a,0x9d42,0x87c2 } }, - { { 0x3fb2,0x4944,0xc9cd,0x3c51 } }, - { { 0x3ff0,0x0000,0x0000,0x0000 } } -}; -#define MAXGAM 171.624376956302725 -#endif - -/* Stirling's formula for the gamma function */ -#if UNK -static const uD STIR[5] = { - { { 7.87311395793093628397E-4 } }, - { { -2.29549961613378126380E-4 } }, - { { -2.68132617805781232825E-3 } }, - { { 3.47222221605458667310E-3 } }, - { { 8.33333333333482257126E-2 } } -}; -#define MAXSTIR 143.01608 -static const double SQTPI = 2.50662827463100050242E0; -#endif -#if IBMPC -static const uD STIR[5] = { - { { 0x7293,0x592d,0xcc72,0x3f49 } }, - { { 0x1d7c,0x27e6,0x166b,0xbf2e } }, - { { 0x4fd7,0x07d4,0xf726,0xbf65 } }, - { { 0xc5fd,0x1b98,0x71c7,0x3f6c } }, - { { 0x5986,0x5555,0x5555,0x3fb5 } } -}; -#define MAXSTIR 143.01608 - -static const union -{ - unsigned short s[4]; - double d; -} sqt = {{0x2706,0x1ff6,0x0d93,0x4004}}; -#define SQTPI (sqt.d) -#endif -#if MIEEE -static const uD STIR[5] = { - { { 0x3f49,0xcc72,0x592d,0x7293 } }, - { { 0xbf2e,0x166b,0x27e6,0x1d7c } }, - { { 0xbf65,0xf726,0x07d4,0x4fd7 } }, - { { 0x3f6c,0x71c7,0x1b98,0xc5fd } }, - { { 0x3fb5,0x5555,0x5555,0x5986 } } -}; -#define MAXSTIR 143.01608 -static const uD SQT = { - { { 0x4004,0x0d93,0x1ff6,0x2706 } } -}; -#define SQTPI SQT.d -#endif - -static double stirf (double); - -/* Gamma function computed by Stirling's formula. - * The polynomial STIR is valid for 33 <= x <= 172. - */ -static double stirf(double x) -{ - double y, w, v; - - w = 1.0/x; - w = 1.0 + w * polevl(w, STIR, 4); - y = exp(x); - if (x > MAXSTIR) - { /* Avoid overflow in pow() */ - v = pow(x, 0.5 * x - 0.25); - y = v * (v / y); - } - else - { - y = pow(x, x - 0.5) / y; - } - y = SQTPI * y * w; - return (y); -} - - -double __tgamma_r(double x, int *sgngam); - -double __tgamma_r(double x, int *sgngam) -{ - double p, q, z; - int i; - - *sgngam = 1; -#ifdef NANS - if (isnan(x)) - return (x); -#endif -#ifdef INFINITIES -#ifdef NANS - if (x == INFINITY) - return (x); - if (x == -INFINITY) - return (NAN); -#else - if (!isfinite(x)) - return (x); -#endif -#endif - if (x == 0.0) - return copysign(HUGE_VAL, x); - - q = fabs(x); - - if (q > 33.0) - { - if (x < 0.0) - { - p = floor(q); - if (p == q) - { -gsing: - _SET_ERRNO(EDOM); - mtherr("tgamma", SING); -#ifdef NANS - return (NAN); -#else - return (MAXNUM); -#endif - } - i = p; - if ((i & 1) == 0) - *sgngam = -1; - z = q - p; - if (z > 0.5) - { - p += 1.0; - z = q - p; - } - z = q * sin(PI * z); - if (z == 0.0) - { - _SET_ERRNO(ERANGE); - mtherr("tgamma", OVERFLOW); -#ifdef INFINITIES - return (*sgngam * INFINITY); -#else - return (*sgngam * MAXNUM); -#endif - } - z = fabs(z); - z = PI/(z * stirf(q)); - } - else - { - z = stirf(x); - } - return (*sgngam * z); - } - - z = 1.0; - while (x >= 3.0) - { - x -= 1.0; - z *= x; - } - - while (x < 0.0) - { - if (x > -1.E-9) - goto Small; - z /= x; - x += 1.0; - } - - while (x < 2.0) - { - if (x < 1.e-9) - goto Small; - z /= x; - x += 1.0; - } - - if (x == 2.0) - return (z); - - x -= 2.0; - p = polevl( x, P, 6 ); - q = polevl( x, Q, 7 ); - return (z * p / q); - -Small: - if (x == 0.0) - { - goto gsing; - } - else - return (z/((1.0 + 0.5772156649015329 * x) * x)); -} - -/* This is the C99 version */ -double tgamma(double x) -{ - int local_sgngam = 0; - return (__tgamma_r(x, &local_sgngam)); -} - diff --git a/lib/libc/mingw/math/tgammaf.c b/lib/libc/mingw/math/tgammaf.c deleted file mode 100644 index 742d1464183a..000000000000 --- a/lib/libc/mingw/math/tgammaf.c +++ /dev/null @@ -1,196 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include "cephes_mconf.h" - -/* define MAXGAM 34.84425627277176174 */ - -/* Stirling's formula for the gamma function - * gamma(x) = sqrt(2 pi) x^(x-.5) exp(-x) ( 1 + 1/x P(1/x) ) - * .028 < 1/x < .1 - * relative error < 1.9e-11 - */ -static const float STIR[] = { - -2.705194986674176E-003, - 3.473255786154910E-003, - 8.333331788340907E-002, -}; -static const float MAXSTIR = 26.77; -static const float SQTPIF = 2.50662827463100050242; /* sqrt( 2 pi ) */ - -static float stirf(float); - -/* Gamma function computed by Stirling's formula, - * sqrt(2 pi) x^(x-.5) exp(-x) (1 + 1/x P(1/x)) - * The polynomial STIR is valid for 33 <= x <= 172. - */ -static float stirf( float x ) -{ - float y, w, v; - - w = 1.0/x; - w = 1.0 + w * polevlf(w, STIR, 2); - y = expf(-x); - if (x > MAXSTIR) - { /* Avoid overflow in pow() */ - v = powf(x, 0.5 * x - 0.25); - y *= v; - y *= v; - } - else - { - y = powf(x, x - 0.5) * y; - } - y = SQTPIF * y * w; - return (y); -} - - -/* gamma(x+2), 0 < x < 1 */ -static const float P[] = { - 1.536830450601906E-003, - 5.397581592950993E-003, - 4.130370201859976E-003, - 7.232307985516519E-002, - 8.203960091619193E-002, - 4.117857447645796E-001, - 4.227867745131584E-001, - 9.999999822945073E-001, -}; - -float __tgammaf_r( float x, int* sgngamf); - -float __tgammaf_r( float x, int* sgngamf) -{ - float p, q, z, nz; - int i, direction, negative; - -#ifdef NANS - if (isnan(x)) - return (x); -#endif -#ifdef INFINITIES -#ifdef NANS - if (x == INFINITYF) - return (x); - if (x == -INFINITYF) - return (NANF); -#else - if (!isfinite(x)) - return (x); -#endif -#endif - if (x == 0.0) - return copysignf(HUGE_VALF, x); - - *sgngamf = 1; - negative = 0; - nz = 0.0; - if (x < 0.0) - { - negative = 1; - q = -x; - p = floorf(q); - if (p == q) - { -gsing: - _SET_ERRNO(EDOM); - mtherr("tgammaf", SING); -#ifdef NANS - return (NAN); -#else - return (MAXNUMF); -#endif - } - i = p; - if ((i & 1) == 0) - *sgngamf = -1; - nz = q - p; - if (nz > 0.5) - { - p += 1.0; - nz = q - p; - } - nz = q * sinf(PIF * nz); - if (nz == 0.0) - { - _SET_ERRNO(ERANGE); - mtherr("tgamma", OVERFLOW); -#ifdef INFINITIES - return(*sgngamf * INFINITYF); -#else - return(*sgngamf * MAXNUMF); -#endif - } - if (nz < 0) - nz = -nz; - x = q; - } - if (x >= 10.0) - { - z = stirf(x); - } - if (x < 2.0) - direction = 1; - else - direction = 0; - z = 1.0; - while (x >= 3.0) - { - x -= 1.0; - z *= x; - } - /* - while (x < 0.0) - { - if (x > -1.E-4) - goto Small; - z *=x; - x += 1.0; - } - */ - while (x < 2.0) - { - if (x < 1.e-4) - goto Small; - z *=x; - x += 1.0; - } - - if (direction) - z = 1.0/z; - - if (x == 2.0) - return (z); - - x -= 2.0; - p = z * polevlf(x, P, 7); - -gdone: - if (negative) - { - p = *sgngamf * PIF/(nz * p ); - } - return (p); - -Small: - if (x == 0.0) - { - goto gsing; - } - else - { - p = z / ((1.0 + 0.5772156649015329 * x) * x); - goto gdone; - } -} - -/* This is the C99 version */ -float tgammaf(float x) -{ - int local_sgngamf = 0; - return (__tgammaf_r(x, &local_sgngamf)); -} - diff --git a/lib/libc/mingw/math/x86/acosh.c b/lib/libc/mingw/math/x86/acosh.c deleted file mode 100644 index ef7007f9d2f9..000000000000 --- a/lib/libc/mingw/math/x86/acosh.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - This Software is provided under the Zope Public License (ZPL) Version 2.1. - - Copyright (c) 2009, 2010 by the mingw-w64 project - - See the AUTHORS file for the list of contributors to the mingw-w64 project. - - This license has been certified as open source. It has also been designated - as GPL compatible by the Free Software Foundation (FSF). - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions in source code must retain the accompanying copyright - notice, this list of conditions, and the following disclaimer. - 2. Redistributions in binary form must reproduce the accompanying - copyright notice, this list of conditions, and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - 3. Names of the copyright holders must not be used to endorse or promote - products derived from this software without prior written permission - from the copyright holders. - 4. The right to distribute this software or to use it for any purpose does - not give you the right to use Servicemarks (sm) or Trademarks (tm) of - the copyright holders. Use of them is covered by separate agreement - with the copyright holders. - 5. If any files are modified, you must cause the modified files to carry - prominent notices stating that you changed the files and the date of - any change. - - Disclaimer - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define _NEW_COMPLEX_DOUBLE 1 -#include "acosh.def.h" diff --git a/lib/libc/mingw/math/x86/acoshf.c b/lib/libc/mingw/math/x86/acoshf.c deleted file mode 100644 index a5a78eb43b1c..000000000000 --- a/lib/libc/mingw/math/x86/acoshf.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - This Software is provided under the Zope Public License (ZPL) Version 2.1. - - Copyright (c) 2009, 2010 by the mingw-w64 project - - See the AUTHORS file for the list of contributors to the mingw-w64 project. - - This license has been certified as open source. It has also been designated - as GPL compatible by the Free Software Foundation (FSF). - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions in source code must retain the accompanying copyright - notice, this list of conditions, and the following disclaimer. - 2. Redistributions in binary form must reproduce the accompanying - copyright notice, this list of conditions, and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - 3. Names of the copyright holders must not be used to endorse or promote - products derived from this software without prior written permission - from the copyright holders. - 4. The right to distribute this software or to use it for any purpose does - not give you the right to use Servicemarks (sm) or Trademarks (tm) of - the copyright holders. Use of them is covered by separate agreement - with the copyright holders. - 5. If any files are modified, you must cause the modified files to carry - prominent notices stating that you changed the files and the date of - any change. - - Disclaimer - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define _NEW_COMPLEX_FLOAT 1 -#include "acosh.def.h" diff --git a/lib/libc/mingw/math/x86/asinh.c b/lib/libc/mingw/math/x86/asinh.c deleted file mode 100644 index 002aedee8c8f..000000000000 --- a/lib/libc/mingw/math/x86/asinh.c +++ /dev/null @@ -1,74 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -#include -#include -#include "fastmath.h" - - /* asinh(x) = copysign(log(fabs(x) + sqrt(x * x + 1.0)), x) */ -double asinh(double x) -{ - double z; - if (!isfinite (x)) - return x; - z = fabs (x); - - /* Avoid setting FPU underflow exception flag in x * x. */ -#if 0 - if ( z < 0x1p-32) - return x; -#endif - - /* NB the previous formula - z = __fast_log1p (z + z * z / (__fast_sqrt (z * z + 1.0) + 1.0)); - was defective in two ways: - 1: It ommitted required brackets: - z = __fast_log1p (z + z * (z / (__fast_sqrt (z * z + 1.0) + 1.0))); - ^ ^ - so would still overflow for large z. - 2: Even with the brackets, it still degraded quickly for large z - (where z*z+1 == z*z). - e.g. asinh (sinh 356.0)) gave 355.30685281944005 - */ - - const double asinhCutover = pow(2,DBL_MAX_EXP/2); // 1.3407807929943e+154 - - if (z < asinhCutover) - /* After excluding large values, the rearranged formula gives better results - the original formula log(z + sqrt(z * z + 1.0)) for very small z. - e.g. rearranged asinh(sinh 2e-301)) = 2e-301 - original asinh(sinh 2e-301)) = 0. - asinh(z) = log (z + sqrt (z * z + 1.0)) - = log1p (z + sqrt (z * z + 1.0) - 1.0) - = log1p (z + (sqrt (z * z + 1.0) - 1.0) - * (sqrt (z * z + 1.0) + 1.0) - / (sqrt (z * z + 1.0) + 1.0)) - = log1p (z + ((z * z + 1.0) - 1.0) - / (sqrt (z * z + 1.0) + 1.0)) - = log1p (z + z * z / (sqrt (z * z + 1.0) + 1.0)) - */ - z = __fast_log1p (z + z * (z / (__fast_sqrt (z * z + 1.0) + 1.0))); - else - /* above this, z*z+1 == z*z, so we can simplify - (and avoid z*z being infinity). - asinh(z) = log (z + sqrt (z * z + 1.0)) - = log (z + sqrt (z * z )) - = log (2 * z) - = log 2 + log z - Choosing asinhCutover is a little tricky. - We'd like something that's based on the nature of - the numeric type (DBL_MAX_EXP, etc). - If c = asinhCutover, then we need: - (1) c*c == c*c + 1 - (2) log (2*c) = log 2 + log c. - For float: - 9.490626562425156e7 is the smallest value that - achieves (1), but it fails (2). (It only just fails, - but enough to make the function erroneously non-monotonic). - */ - z = __fast_log(2) + __fast_log(z); - return copysign(z, x); //ensure 0.0 -> 0.0 and -0.0 -> -0.0. -} diff --git a/lib/libc/mingw/math/x86/asinhf.c b/lib/libc/mingw/math/x86/asinhf.c deleted file mode 100644 index c3d885054780..000000000000 --- a/lib/libc/mingw/math/x86/asinhf.c +++ /dev/null @@ -1,34 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -#include -#include -#include "fastmath.h" - - /* asinh(x) = copysign(log(fabs(x) + sqrt(x * x + 1.0)), x) */ -float asinhf(float x) -{ - float z; - if (!isfinite (x)) - return x; - z = fabsf (x); - - /* Avoid setting FPU underflow exception flag in x * x. */ -#if 0 - if ( z < 0x1p-32) - return x; -#endif - - /* See commentary in asinh */ - const float asinhCutover = pow(2,FLT_MAX_EXP/2); - - if (z < asinhCutover) - z = __fast_log1p (z + z * (z / (__fast_sqrt (z * z + 1.0) + 1.0))); - //z = __fast_log(z + __fast_sqrt(z * z + 1.0)); - else - z = __fast_log(2) + __fast_log(z); - return copysignf(z, x); //ensure 0.0 -> 0.0 and -0.0 -> -0.0. -} diff --git a/lib/libc/mingw/math/x86/atan2.c b/lib/libc/mingw/math/x86/atan2.c deleted file mode 100644 index 1d8a0997875a..000000000000 --- a/lib/libc/mingw/math/x86/atan2.c +++ /dev/null @@ -1,15 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -double -atan2 (double y, double x) -{ - double res = 0.0; - asm volatile ("fpatan" : "=t" (res) : "u" (y), "0" (x) : "st(1)"); - return res; -} diff --git a/lib/libc/mingw/math/x86/atanh.c b/lib/libc/mingw/math/x86/atanh.c deleted file mode 100644 index b3aa76fe91e1..000000000000 --- a/lib/libc/mingw/math/x86/atanh.c +++ /dev/null @@ -1,36 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -#include -#include "fastmath.h" - -/* atanh (x) = 0.5 * log ((1.0 + x)/(1.0 - x)) */ - -double atanh(double x) -{ - double z; - if (isnan (x)) - return x; - z = fabs (x); - if (z == 1.0) - { - errno = ERANGE; - return (x > 0 ? INFINITY : -INFINITY); - } - if (z > 1.0) - { - errno = EDOM; - return nan(""); - } - /* Rearrange formula to avoid precision loss for small x. - - atanh(x) = 0.5 * log ((1.0 + x)/(1.0 - x)) - = 0.5 * log1p ((1.0 + x)/(1.0 - x) - 1.0) - = 0.5 * log1p ((1.0 + x - 1.0 + x) /(1.0 - x)) - = 0.5 * log1p ((2.0 * x ) / (1.0 - x)) */ - z = 0.5 * __fast_log1p ((z + z) / (1.0 - z)); - return copysign(z, x); //ensure 0.0 -> 0.0 and -0.0 -> -0.0. -} diff --git a/lib/libc/mingw/math/x86/atanhf.c b/lib/libc/mingw/math/x86/atanhf.c deleted file mode 100644 index 9adc6902de5e..000000000000 --- a/lib/libc/mingw/math/x86/atanhf.c +++ /dev/null @@ -1,35 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -#include -#include "fastmath.h" - -/* atanh (x) = 0.5 * log ((1.0 + x)/(1.0 - x)) */ -float atanhf (float x) -{ - float z; - if (isnan (x)) - return x; - z = fabsf (x); - if (z == 1.0) - { - errno = ERANGE; - return (x > 0 ? INFINITY : -INFINITY); - } - if ( z > 1.0) - { - errno = EDOM; - return nanf(""); - } - /* Rearrange formula to avoid precision loss for small x. - - atanh(x) = 0.5 * log ((1.0 + x)/(1.0 - x)) - = 0.5 * log1p ((1.0 + x)/(1.0 - x) - 1.0) - = 0.5 * log1p ((1.0 + x - 1.0 + x) /(1.0 - x)) - = 0.5 * log1p ((2.0 * x ) / (1.0 - x)) */ - z = 0.5 * __fast_log1p ((z + z) / (1.0 - z)); - return copysignf(z, x); //ensure 0.0 -> 0.0 and -0.0 -> -0.0. -} diff --git a/lib/libc/mingw/math/x86/ceil.S b/lib/libc/mingw/math/x86/ceil.S deleted file mode 100644 index c20343aa45ab..000000000000 --- a/lib/libc/mingw/math/x86/ceil.S +++ /dev/null @@ -1,115 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "ceil.S" - .text - .align 4 - .globl __MINGW_USYMBOL(ceil) - .def __MINGW_USYMBOL(ceil); .scl 2; .type 32; .endef -#ifdef __x86_64__ - .seh_proc __MINGW_USYMBOL(ceil) -#endif - -__MINGW_USYMBOL(ceil): -#if defined(_AMD64_) || defined(__x86_64__) - .seh_endprologue - movd %xmm0, %rax - movq %rax, %rcx - sarq $52, %rcx - andl $2047, %ecx - subl $1023, %ecx - cmpl $51, %ecx - jg .is_intnaninf - /* Is x zero? */ - testq %rax, %rax - je .ret_org - /* Is x signed? */ - testl %ecx, %ecx - js .signed_val - /* Is x integral? */ - movabsq $4503599627370495, %rdx - sarq %cl, %rdx - testq %rax, %rdx - je .ret_org - addsd .huge(%rip), %xmm0 - ucomisd .zero(%rip), %xmm0 - jbe .doret - testq %rax, %rax - jle .l1 - /* inexact ... */ - movabsq $4503599627370496, %r8 - shrq %cl, %r8 - addq %r8, %rax -.l1: - notq %rdx - andq %rdx, %rax -.doret: - movd %rax, %xmm0 - ret - .p2align 4,,10 -.signed_val: - addsd .huge(%rip), %xmm0 - ucomisd .zero(%rip), %xmm0 - jbe .doret2 - testq %rax, %rax - movabsq $4607182418800017408, %rdx - movabsq $-9223372036854775808, %rax - cmovns %rdx, %rax - .p2align 4,,10 -.doret2: - movd %rax, %xmm0 - ret - - .p2align 4,,10 -.is_intnaninf: - /* Is Nan or Inf? */ - cmpl $1024, %ecx - je .ret_naninf - .p2align 4,,10 -.ret_org: - /* return x. */ - rep - ret - .p2align 4,,10 -.ret_naninf: - /* return x + x; */ - addsd %xmm0, %xmm0 - ret - .seh_endproc - -/* local data. */ - .section .rdata,"dr" - .align 8 -.huge: - .long -2013235812 - .long 2117592124 - .align 8 -.zero: - .long 0 - .long 0 -#elif defined(_X86_) || defined(__i386__) - fldl 4(%esp) - subl $8,%esp - - fstcw 4(%esp) /* store fpu control word */ - - /* We use here %edx although only the low 1 bits are defined. - But none of the operations should care and they are faster - than the 16 bit operations. */ - movl $0x0800,%edx /* round towards +oo */ - orl 4(%esp),%edx - andl $0xfbff,%edx - movl %edx,(%esp) - fldcw (%esp) /* load modified control word */ - - frndint /* round */ - - fldcw 4(%esp) /* restore original control word */ - - addl $8,%esp - ret -#endif diff --git a/lib/libc/mingw/math/x86/cos.c b/lib/libc/mingw/math/x86/cos.c deleted file mode 100644 index eea812b760cf..000000000000 --- a/lib/libc/mingw/math/x86/cos.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - This Software is provided under the Zope Public License (ZPL) Version 2.1. - - Copyright (c) 2009, 2010 by the mingw-w64 project - - See the AUTHORS file for the list of contributors to the mingw-w64 project. - - This license has been certified as open source. It has also been designated - as GPL compatible by the Free Software Foundation (FSF). - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions in source code must retain the accompanying copyright - notice, this list of conditions, and the following disclaimer. - 2. Redistributions in binary form must reproduce the accompanying - copyright notice, this list of conditions, and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - 3. Names of the copyright holders must not be used to endorse or promote - products derived from this software without prior written permission - from the copyright holders. - 4. The right to distribute this software or to use it for any purpose does - not give you the right to use Servicemarks (sm) or Trademarks (tm) of - the copyright holders. Use of them is covered by separate agreement - with the copyright holders. - 5. If any files are modified, you must cause the modified files to carry - prominent notices stating that you changed the files and the date of - any change. - - Disclaimer - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define _NEW_COMPLEX_DOUBLE 1 -#include "cos.def.h" diff --git a/lib/libc/mingw/math/x86/exp.c b/lib/libc/mingw/math/x86/exp.c deleted file mode 100644 index 5df131af165a..000000000000 --- a/lib/libc/mingw/math/x86/exp.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - This Software is provided under the Zope Public License (ZPL) Version 2.1. - - Copyright (c) 2009, 2010 by the mingw-w64 project - - See the AUTHORS file for the list of contributors to the mingw-w64 project. - - This license has been certified as open source. It has also been designated - as GPL compatible by the Free Software Foundation (FSF). - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions in source code must retain the accompanying copyright - notice, this list of conditions, and the following disclaimer. - 2. Redistributions in binary form must reproduce the accompanying - copyright notice, this list of conditions, and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - 3. Names of the copyright holders must not be used to endorse or promote - products derived from this software without prior written permission - from the copyright holders. - 4. The right to distribute this software or to use it for any purpose does - not give you the right to use Servicemarks (sm) or Trademarks (tm) of - the copyright holders. Use of them is covered by separate agreement - with the copyright holders. - 5. If any files are modified, you must cause the modified files to carry - prominent notices stating that you changed the files and the date of - any change. - - Disclaimer - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define _NEW_COMPLEX_DOUBLE 1 -#include "exp.def.h" diff --git a/lib/libc/mingw/math/x86/exp2.S b/lib/libc/mingw/math/x86/exp2.S deleted file mode 100644 index 37d4a2b898a1..000000000000 --- a/lib/libc/mingw/math/x86/exp2.S +++ /dev/null @@ -1,94 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "exp2.S" - .text -#ifdef __x86_64__ - .align 8 -#else - .align 4 -#endif -.globl __MINGW_USYMBOL(exp2) - .def __MINGW_USYMBOL(exp2); .scl 2; .type 32; .endef -__MINGW_USYMBOL(exp2): -#ifdef __x86_64__ - subq $24, %rsp - movsd %xmm0,(%rsp) - fldl (%rsp) - fxam /* Is NaN or +-Inf? */ - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 1f /* Is +-Inf, jump. */ - fld %st - subq $8, %rsp /* int(x) */ - fnstcw 4(%rsp) - movzwl 4(%rsp), %eax - orb $12, %ah - movw %ax, (%rsp) - fldcw (%rsp) - frndint - fldcw 4(%rsp) - addq $8, %rsp - fsubr %st,%st(1) /* fract(x) */ - fxch - f2xm1 /* 2^(fract(x)) - 1 */ - fld1 - faddp /* 2^(fract(x)) */ - fscale /* e^x */ - fstp %st(1) - fstpl (%rsp) - movsd (%rsp),%xmm0 - addq $24, %rsp - ret - -1: testl $0x200, %eax /* Test sign. */ - jz 2f /* If positive, jump. */ - fstp %st - fldz /* Set result to 0. */ -2: fstpl (%rsp) - movsd (%rsp),%xmm0 - addq $24,%rsp - ret -#else - fldl 4(%esp) -/* I added the following ugly construct because exp(+-Inf) resulted - in NaN. The ugliness results from the bright minds at Intel. - For the i686 the code can be written better. - -- drepper@cygnus.com. */ - fxam /* Is NaN or +-Inf? */ - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 1f /* Is +-Inf, jump. */ - fld %st - subl $8, %esp /* int(x) */ - fnstcw 4(%esp) - movzwl 4(%esp), %eax - orb $12, %ah - movw %ax, (%esp) - fldcw (%esp) - frndint - fldcw 4(%esp) - addl $8, %esp - fsubr %st,%st(1) /* fract(x) */ - fxch - f2xm1 /* 2^(fract(x)) - 1 */ - fld1 - faddp /* 2^(fract(x)) */ - fscale /* e^x */ - fstp %st(1) - ret - -1: testl $0x200, %eax /* Test sign. */ - jz 2f /* If positive, jump. */ - fstp %st - fldz /* Set result to 0. */ -2: ret -#endif diff --git a/lib/libc/mingw/math/x86/exp2f.S b/lib/libc/mingw/math/x86/exp2f.S deleted file mode 100644 index fa9f19c553ad..000000000000 --- a/lib/libc/mingw/math/x86/exp2f.S +++ /dev/null @@ -1,94 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "exp2f.S" - .text -#ifdef __x86_64__ - .align 8 -#else - .align 4 -#endif -.globl __MINGW_USYMBOL(exp2f) - .def __MINGW_USYMBOL(exp2f); .scl 2; .type 32; .endef -__MINGW_USYMBOL(exp2f): -#ifdef __x86_64__ - subq $24, %rsp - movss %xmm0,(%rsp) - flds (%rsp) - fxam /* Is NaN or +-Inf? */ - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 1f /* Is +-Inf, jump. */ - fld %st - subq $8, %rsp /* int(x) */ - fnstcw 4(%rsp) - movzwl 4(%rsp), %eax - orb $12, %ah - movw %ax, (%rsp) - fldcw (%rsp) - frndint - fldcw 4(%rsp) - addq $8, %rsp - fsubr %st,%st(1) /* fract(x) */ - fxch - f2xm1 /* 2^(fract(x)) - 1 */ - fld1 - faddp /* 2^(fract(x)) */ - fscale /* e^x */ - fstp %st(1) - fstps (%rsp) - movss (%rsp),%xmm0 - addq $24, %rsp - ret - -1: testl $0x200, %eax /* Test sign. */ - jz 2f /* If positive, jump. */ - fstp %st - fldz /* Set result to 0. */ -2: fstps (%rsp) - movss (%rsp),%xmm0 - addq $24, %rsp - ret -#else - flds 4(%esp) -/* I added the following ugly construct because exp(+-Inf) resulted - in NaN. The ugliness results from the bright minds at Intel. - For the i686 the code can be written better. - -- drepper@cygnus.com. */ - fxam /* Is NaN or +-Inf? */ - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 1f /* Is +-Inf, jump. */ - fld %st - subl $8, %esp /* int(x) */ - fnstcw 4(%esp) - movzwl 4(%esp), %eax - orb $12, %ah - movw %ax, (%esp) - fldcw (%esp) - frndint - fldcw 4(%esp) - addl $8, %esp - fsubr %st,%st(1) /* fract(x) */ - fxch - f2xm1 /* 2^(fract(x)) - 1 */ - fld1 - faddp /* 2^(fract(x)) */ - fscale /* e^x */ - fstp %st(1) - ret - -1: testl $0x200, %eax /* Test sign. */ - jz 2f /* If positive, jump. */ - fstp %st - fldz /* Set result to 0. */ -2: ret -#endif diff --git a/lib/libc/mingw/math/x86/expm1.c b/lib/libc/mingw/math/x86/expm1.c deleted file mode 100644 index 65fd64bc5f43..000000000000 --- a/lib/libc/mingw/math/x86/expm1.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - This Software is provided under the Zope Public License (ZPL) Version 2.1. - - Copyright (c) 2009, 2010 by the mingw-w64 project - - See the AUTHORS file for the list of contributors to the mingw-w64 project. - - This license has been certified as open source. It has also been designated - as GPL compatible by the Free Software Foundation (FSF). - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions in source code must retain the accompanying copyright - notice, this list of conditions, and the following disclaimer. - 2. Redistributions in binary form must reproduce the accompanying - copyright notice, this list of conditions, and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - 3. Names of the copyright holders must not be used to endorse or promote - products derived from this software without prior written permission - from the copyright holders. - 4. The right to distribute this software or to use it for any purpose does - not give you the right to use Servicemarks (sm) or Trademarks (tm) of - the copyright holders. Use of them is covered by separate agreement - with the copyright holders. - 5. If any files are modified, you must cause the modified files to carry - prominent notices stating that you changed the files and the date of - any change. - - Disclaimer - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define _NEW_COMPLEX_DOUBLE 1 -#include "expm1.def.h" diff --git a/lib/libc/mingw/math/x86/expm1f.c b/lib/libc/mingw/math/x86/expm1f.c deleted file mode 100644 index ab80717eba5f..000000000000 --- a/lib/libc/mingw/math/x86/expm1f.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - This Software is provided under the Zope Public License (ZPL) Version 2.1. - - Copyright (c) 2009, 2010 by the mingw-w64 project - - See the AUTHORS file for the list of contributors to the mingw-w64 project. - - This license has been certified as open source. It has also been designated - as GPL compatible by the Free Software Foundation (FSF). - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions in source code must retain the accompanying copyright - notice, this list of conditions, and the following disclaimer. - 2. Redistributions in binary form must reproduce the accompanying - copyright notice, this list of conditions, and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - 3. Names of the copyright holders must not be used to endorse or promote - products derived from this software without prior written permission - from the copyright holders. - 4. The right to distribute this software or to use it for any purpose does - not give you the right to use Servicemarks (sm) or Trademarks (tm) of - the copyright holders. Use of them is covered by separate agreement - with the copyright holders. - 5. If any files are modified, you must cause the modified files to carry - prominent notices stating that you changed the files and the date of - any change. - - Disclaimer - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define _NEW_COMPLEX_FLOAT 1 -#include "expm1.def.h" diff --git a/lib/libc/mingw/math/x86/floor.S b/lib/libc/mingw/math/x86/floor.S deleted file mode 100644 index 6e436a87375d..000000000000 --- a/lib/libc/mingw/math/x86/floor.S +++ /dev/null @@ -1,167 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "floor.S" - .text - .p2align 4,,15 - .globl __MINGW_USYMBOL(floor) - .def __MINGW_USYMBOL(floor); .scl 2; .type 32; .endef -#ifdef __x86_64__ - .seh_proc __MINGW_USYMBOL(floor) -#endif -__MINGW_USYMBOL(floor): -#if defined(_AMD64_) || defined(__x86_64__) - pushq %rbx - .seh_pushreg %rbx - subq $16, %rsp - .seh_stackalloc 16 - .seh_endprologue - movsd %xmm0, 8(%rsp) - movq 8(%rsp), %r9 - movq %r9, %rdx - movl %r9d, %r10d - shrq $32, %rdx - movl %edx, %eax - movl %edx, %r11d - sarl $20, %eax - andl $2047, %eax - leal -1023(%rax), %r8d - cmpl $51, %r8d - jle .L2 - cmpl $1024, %r8d - je .L27 -.L3: - addq $16, %rsp - popq %rbx - ret - .p2align 4,,10 -.L2: - cmpl $19, %r8d - jg .L4 - testl %r8d, %r8d - js .L28 - movl $1048575, %eax - movl %r8d, %ecx - shrl %cl, %eax - testl %r9d, %r9d - jne .L8 - testl %edx, %eax - je .L3 -.L8: - movsd .hugeval(%rip), %xmm1 - xorpd %xmm2, %xmm2 - addsd %xmm0, %xmm1 - ucomisd %xmm1, %xmm2 - jae .L3 - xorl %r9d, %r9d - testl %edx, %edx - jns .L9 - movl $1048576, %r9d - movl %r8d, %ecx - sarl %cl, %r9d -.L9: - addl %r9d, %edx - notl %eax - andl %edx, %eax - salq $32, %rax - movq %rax, 8(%rsp) - movsd 8(%rsp), %xmm0 - addq $16, %rsp - popq %rbx - ret - .p2align 4,,10 -.L4: - leal -1043(%rax), %ecx - movl $-1, %ebx - shrl %cl, %ebx - testl %r9d, %ebx - je .L3 - movsd .hugeval(%rip), %xmm1 - xorpd %xmm2, %xmm2 - addsd %xmm0, %xmm1 - ucomisd %xmm1, %xmm2 - jae .L3 - testl %edx, %edx - js .L29 -.L11: - notl %ebx - salq $32, %r11 - andl %ebx, %r10d - orq %r10, %r11 - movq %r11, 8(%rsp) - movsd 8(%rsp), %xmm0 - addq $16, %rsp - popq %rbx - ret - .p2align 4,,10 -.L27: - addsd %xmm0, %xmm0 - addq $16, %rsp - popq %rbx - ret - .p2align 4,,10 -.L28: - movsd .hugeval(%rip), %xmm2 - xorpd %xmm1, %xmm1 - addsd %xmm0, %xmm2 - ucomisd %xmm1, %xmm2 - jbe .L3 - testl %edx, %edx - js .L7 - movapd %xmm1, %xmm0 - jmp .L3 - .p2align 4,,10 -.L7: - andl $2147483647, %edx - orl %r9d, %edx - je .L3 - movabsq $-4616189618054758400, %rax - movq %rax, 8(%rsp) - movsd 8(%rsp), %xmm0 - jmp .L3 - .p2align 4,,10 -.L29: - cmpl $20, %r8d - je .L25 - movl $1075, %ecx - movl $1, %r10d - subl %eax, %ecx - sall %cl, %r10d - addl %r9d, %r10d - jae .L11 -.L25: - leal 1(%rdx), %r11d - jmp .L11 - .seh_endproc - - .section .rdata,"dr" - .align 8 -.hugeval: - .long -2013235812 - .long 2117592124 -#elif defined(_X86_) || defined(__i386__) - fldl 4(%esp) - subl $8,%esp - - fstcw 4(%esp) /* store fpu control word */ - - /* We use here %edx although only the low 1 bits are defined. - But none of the operations should care and they are faster - than the 16 bit operations. */ - movl $0x400,%edx /* round towards -oo */ - orl 4(%esp),%edx - andl $0xf7ff,%edx - movl %edx,(%esp) - fldcw (%esp) /* load modified control word */ - - frndint /* round */ - - fldcw 4(%esp) /* restore original control word */ - - addl $8,%esp - ret -#endif diff --git a/lib/libc/mingw/math/x86/fmod.c b/lib/libc/mingw/math/x86/fmod.c deleted file mode 100644 index 5764db0354ef..000000000000 --- a/lib/libc/mingw/math/x86/fmod.c +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -double fmod (double x, double y); - -double -fmod (double x, double y) -{ - double res = 0.0; - - asm volatile ( - "1:\tfprem\n\t" - "fstsw %%ax\n\t" - "sahf\n\t" - "jp 1b\n\t" - "fstp %%st(1)" - : "=t" (res) : "0" (x), "u" (y) : "ax", "st(1)"); - return res; -} diff --git a/lib/libc/mingw/math/x86/ilogb.S b/lib/libc/mingw/math/x86/ilogb.S deleted file mode 100644 index b3bf1d216771..000000000000 --- a/lib/libc/mingw/math/x86/ilogb.S +++ /dev/null @@ -1,137 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "ilogb.S" - .text - .p2align 4,,15 -.globl __MINGW_USYMBOL(ilogb) - .def __MINGW_USYMBOL(ilogb); .scl 2; .type 32; .endef -#ifdef __x86_64__ - .seh_proc __MINGW_USYMBOL(ilogb) -#endif -__MINGW_USYMBOL(ilogb): -#ifdef __x86_64__ -/* Generated code by: -int -ilogb (double x) -{ - __mingw_dbl_type_t hlp; - int hx, lx, ix; - - hlp.x = x; - hx = hpl.lh.high & 0x7fffffff; - if (hx < 0x100000) - { - lx = hlp.lh.low; - if ((hx | lx) == 0) - return 0x80000000; // ilogb(0) = FP_ILOGB0 - // subnormal x - if (hx == 0) - { - for (ix = -1043; lx > 0; lx <<= 1) - ix -=1; - } - else - { - for (ix = -1022,hx <<= 11; hx > 0; hx <<= 1) - ix -=1; - } - return ix; - } - if (hx < 0x7ff00000) - return (hx >> 20) - 1023; - lx = hlp.lh.low; - return 0x7fffffff; -} */ - subq $24, %rsp - .seh_stackalloc 24 - .seh_endprologue - movsd %xmm0, 8(%rsp) - movq 8(%rsp), %rdx - shrq $32, %rdx - andl $2147483647, %edx - cmpl $1048575, %edx - jg .L2 - movq 8(%rsp), %rcx - movl %edx, %eax - orl %ecx, %eax - je .L8 - testl %edx, %edx - jne .L4 - testl %ecx, %ecx - movl %ecx, %edx - movl $-1043, %eax - jle .L3 - .p2align 4,,10 -.L5: - addl %edx, %edx - subl $1, %eax - testl %edx, %edx - jg .L5 - addq $24, %rsp - ret - .p2align 4,,10 -.L2: - cmpl $2146435071, %edx - jle .L13 - movl $2147483647, %eax -.L3: - addq $24, %rsp - ret - .p2align 4,,10 -.L4: - sall $11, %edx - movl $-1022, %eax - testl %edx, %edx - jle .L3 - .p2align 4,,10 -.L6: - addl %edx, %edx - subl $1, %eax - testl %edx, %edx - jg .L6 - addq $24, %rsp - ret - .p2align 4,,10 -.L13: - sarl $20, %edx - leal -1023(%rdx), %eax - addq $24, %rsp - ret -.L8: - movl $-2147483648, %eax - jmp .L3 - .seh_endproc -#else - - fldl 4(%esp) -/* I added the following ugly construct because ilogb(+-Inf) is - required to return INT_MAX in ISO C99. - -- jakub@redhat.com. */ - fxam /* Is NaN or +-Inf? */ - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 1f /* Is +-Inf, jump. */ - cmpb $0x01, %dh - je 1f /* Is NaN, jump. */ - - fxtract - pushl %eax - fstp %st - - fistpl (%esp) - fwait - popl %eax - - ret - -1: fstp %st - movl $0x7fffffff, %eax - ret -#endif diff --git a/lib/libc/mingw/math/x86/ilogbf.S b/lib/libc/mingw/math/x86/ilogbf.S deleted file mode 100644 index 4f860dd6917f..000000000000 --- a/lib/libc/mingw/math/x86/ilogbf.S +++ /dev/null @@ -1,106 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "ilogbf.S" - .text - .p2align 4,,15 -.globl __MINGW_USYMBOL(ilogbf) - .def __MINGW_USYMBOL(ilogbf); .scl 2; .type 32; .endef -#ifdef __x86_64__ - .seh_proc __MINGW_USYMBOL(ilogbf) -#endif -__MINGW_USYMBOL(ilogbf): -#ifdef __x86_64__ -/* generated code for: -int -ilogbf (float x) -{ - __mingw_flt_type_t hlp; - int hx, ix; - - hlp.x = x; - hx = (int) hlp.val & 0x7fffffff; - if (hx < 0x800000) - { - if (hx == 0) - return 0x80000000; // ilogb(0) = FP_ILOGB0 - for (ix = -126, hx <<= 8; hx > 0; hx <<= 1) - ix -= 1; - return ix; - } - if (hx < 0x7f800000) - return (hx >> 23) - 127; - return 0x7fffffff; -} */ - subq $24, %rsp - .seh_stackalloc 24 - .seh_endprologue - movss %xmm0, 12(%rsp) - movl 12(%rsp), %edx - andl $2147483647, %edx - cmpl $8388607, %edx - jg .L2 - testl %edx, %edx - je .L6 - sall $8, %edx - movl $-126, %eax - testl %edx, %edx - jle .L3 - .p2align 4,,10 -.L4: - addl %edx, %edx - subl $1, %eax - testl %edx, %edx - jg .L4 -.L3: - addq $24, %rsp - ret - .p2align 4,,10 -.L2: - cmpl $2139095039, %edx - jle .L10 - movl $2147483647, %eax - addq $24, %rsp - ret - .p2align 4,,10 -.L10: - sarl $23, %edx - leal -127(%rdx), %eax - addq $24, %rsp - ret -.L6: - movl $-2147483648, %eax - jmp .L3 - .seh_endproc -#else - flds 4(%esp) -/* I added the following ugly construct because ilogb(+-Inf) is - required to return INT_MAX in ISO C99. - -- jakub@redhat.com. */ - fxam /* Is NaN or +-Inf? */ - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 1f /* Is +-Inf, jump. */ - cmpb $0x01, %dh - je 1f /* Is Nan, jump. */ - - fxtract - pushl %eax - fstp %st - - fistpl (%esp) - fwait - popl %eax - - ret - -1: fstp %st - movl $0x7fffffff, %eax - ret -#endif diff --git a/lib/libc/mingw/math/x86/log1p.S b/lib/libc/mingw/math/x86/log1p.S deleted file mode 100644 index c1a1d2fa65d8..000000000000 --- a/lib/libc/mingw/math/x86/log1p.S +++ /dev/null @@ -1,85 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "log1p.S" - .text -#ifdef __x86_64__ - .align 8 -#else - .align 4 -#endif - /* The fyl2xp1 can only be used for values in - -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2 - 0.29 is a safe value. - */ -limit: .double 0.29 -one: .double 1.0 -/* - * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29, - * otherwise fyl2x with the needed extra computation. - */ -.globl __MINGW_USYMBOL(log1p) - .def __MINGW_USYMBOL(log1p); .scl 2; .type 32; .endef -__MINGW_USYMBOL(log1p): -#ifdef __x86_64__ - movsd %xmm0,-16(%rsp) - fldln2 - fldl -16(%rsp) - fxam - fnstsw - fld %st - sahf - jc 3f // in case x is NaN or ±Inf - -4: fabs - fcompl limit(%rip) - fnstsw - sahf - jc 2f - faddl one(%rip) - fyl2x - fstpl -16(%rsp) - movsd -16(%rsp),%xmm0 - ret - -2: fyl2xp1 - fstpl -16(%rsp) - movsd -16(%rsp),%xmm0 - ret - -3: jp 4b // in case x is ±Inf - fstp %st(1) - fstp %st(1) - fstpl -16(%rsp) - movsd -16(%rsp),%xmm0 - ret -#else - fldln2 - fldl 4(%esp) - fxam - fnstsw - fld %st - sahf - jc 3f // in case x is NaN or ±Inf - -4: fabs - fcompl limit - fnstsw - sahf - jc 2f - faddl one - fyl2x - ret - -2: fyl2xp1 - ret - -3: jp 4b // in case x is ±Inf - fstp %st(1) - fstp %st(1) - ret -#endif diff --git a/lib/libc/mingw/math/x86/log1pf.S b/lib/libc/mingw/math/x86/log1pf.S deleted file mode 100644 index 259e8a8ec158..000000000000 --- a/lib/libc/mingw/math/x86/log1pf.S +++ /dev/null @@ -1,85 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "log1pf.S" - .text -#ifdef __x86_64__ - .align 8 -#else - .align 4 -#endif - /* The fyl2xp1 can only be used for values in - -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2 - 0.29 is a safe value. - */ -limit: .float 0.29 -one: .float 1.0 -/* - * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29, - * otherwise fyl2x with the needed extra computation. - */ -.globl __MINGW_USYMBOL(log1pf) - .def __MINGW_USYMBOL(log1pf); .scl 2; .type 32; .endef -__MINGW_USYMBOL(log1pf): -#ifdef __x86_64__ - movss %xmm0,-12(%rsp) - fldln2 - flds -12(%rsp) - fxam - fnstsw - fld %st - sahf - jc 3f // in case x is NaN or ±Inf - -4: fabs - fcomps limit(%rip) - fnstsw - sahf - jc 2f - fadds one(%rip) - fyl2x - fstps -12(%rsp) - movss -12(%rsp),%xmm0 - ret - -2: fyl2xp1 - fstps -12(%rsp) - movss -12(%rsp),%xmm0 - ret - -3: jp 4b // in case x is ±Inf - fstp %st(1) - fstp %st(1) - fstps -12(%rsp) - movss -12(%rsp),%xmm0 - ret -#else - fldln2 - flds 4(%esp) - fxam - fnstsw - fld %st - sahf - jc 3f // in case x is NaN or ±Inf - -4: fabs - fcomps limit - fnstsw - sahf - jc 2f - fadds one - fyl2x - ret - -2: fyl2xp1 - ret - -3: jp 4b // in case x is ±Inf - fstp %st(1) - fstp %st(1) - ret -#endif diff --git a/lib/libc/mingw/math/x86/log2.S b/lib/libc/mingw/math/x86/log2.S deleted file mode 100644 index 54eecf753b2a..000000000000 --- a/lib/libc/mingw/math/x86/log2.S +++ /dev/null @@ -1,85 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "log2.S" - .text -#ifdef __x86_64__ - .align 8 -#else - .align 4 -#endif -one: .double 1.0 - /* It is not important that this constant is precise. It is only - a value which is known to be on the safe side for using the - fyl2xp1 instruction. */ -limit: .double 0.29 - -.globl __MINGW_USYMBOL(log2) - .def __MINGW_USYMBOL(log2); .scl 2; .type 32; .endef -__MINGW_USYMBOL(log2): -#ifdef __x86_64__ - movsd %xmm0,-16(%rsp) - fldl one(%rip) - fldl -16(%rsp) // x : 1 - fxam - fnstsw - fld %st // x : x : 1 - sahf - jc 3f // in case x is NaN or ±Inf -4: fsub %st(2), %st // x-1 : x : 1 - fld %st // x-1 : x-1 : x : 1 - fabs // |x-1| : x-1 : x : 1 - fcompl limit(%rip) // x-1 : x : 1 - fnstsw // x-1 : x : 1 - andb $0x45, %ah - jz 2f - fstp %st(1) // x-1 : 1 - fyl2xp1 // log(x) - fstpl -16(%rsp) - movsd -16(%rsp),%xmm0 - ret - -2: fstp %st(0) // x : 1 - fyl2x // log(x) - fstpl -16(%rsp) - movsd -16(%rsp),%xmm0 - ret - -3: jp 4b // in case x is ±Inf - fstp %st(1) - fstp %st(1) - fstpl -16(%rsp) - movsd -16(%rsp),%xmm0 - ret -#else - fldl one - fldl 4(%esp) // x : 1 - fxam - fnstsw - fld %st // x : x : 1 - sahf - jc 3f // in case x is NaN or ±Inf -4: fsub %st(2), %st // x-1 : x : 1 - fld %st // x-1 : x-1 : x : 1 - fabs // |x-1| : x-1 : x : 1 - fcompl limit // x-1 : x : 1 - fnstsw // x-1 : x : 1 - andb $0x45, %ah - jz 2f - fstp %st(1) // x-1 : 1 - fyl2xp1 // log(x) - ret - -2: fstp %st(0) // x : 1 - fyl2x // log(x) - ret - -3: jp 4b // in case x is ±Inf - fstp %st(1) - fstp %st(1) - ret -#endif diff --git a/lib/libc/mingw/math/x86/logb.c b/lib/libc/mingw/math/x86/logb.c deleted file mode 100644 index d522110e2a83..000000000000 --- a/lib/libc/mingw/math/x86/logb.c +++ /dev/null @@ -1,40 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -/* - * Written by J.T. Conklin . - * Changes for long double by Ulrich Drepper - * Public domain. - */ - -#include - -double -logb (double x) -{ -#ifdef __x86_64__ - __mingw_dbl_type_t hlp; - int lx, hx; - - hlp.x = x; - lx = hlp.lh.low; - hx = hlp.lh.high & 0x7fffffff; /* high |x| */ - if ((hx | lx) == 0) - return -1.0 / fabs (x); - if (hx >= 0x7ff00000) - return x * x; - if ((hx >>= 20) == 0) { - unsigned long long mantissa = hlp.val & 0xfffffffffffffULL; - return -1023.0 - (__builtin_clzll(mantissa) - 12); - } - return (double) (hx - 1023); -#else - double res = 0.0; - asm volatile ( - "fxtract\n\t" - "fstp %%st" : "=t" (res) : "0" (x)); - return res; -#endif -} diff --git a/lib/libc/mingw/math/x86/logbf.c b/lib/libc/mingw/math/x86/logbf.c deleted file mode 100644 index 2d62233ed5d1..000000000000 --- a/lib/libc/mingw/math/x86/logbf.c +++ /dev/null @@ -1,37 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -/* - * Written by J.T. Conklin . - * Changes for long double by Ulrich Drepper - * Public domain. - */ - -#include - -float -logbf (float x) -{ -#ifdef __x86_64__ - int v; - __mingw_flt_type_t hlp; - - hlp.x = x; - v = hlp.val & 0x7fffffff; /* high |x| */ - if (!v) - return (float)-1.0 / fabsf (x); - if (v >= 0x7f800000) - return x * x; - if ((v >>= 23) == 0) - return -127.0 - (__builtin_clzl(hlp.val & 0x7fffff) - 9); - return (float) (v - 127); -#else - float res = 0.0F; - asm volatile ( - "fxtract\n\t" - "fstp %%st" : "=t" (res) : "0" (x)); - return res; -#endif -} diff --git a/lib/libc/mingw/math/x86/nearbyint.S b/lib/libc/mingw/math/x86/nearbyint.S deleted file mode 100644 index a0a85348c70a..000000000000 --- a/lib/libc/mingw/math/x86/nearbyint.S +++ /dev/null @@ -1,51 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "nearbyint.S" - .text -#ifdef __x86_64__ - .align 8 -#else - .align 4 -#endif - .globl __MINGW_USYMBOL(nearbyint) - .def __MINGW_USYMBOL(nearbyint); .scl 2; .type 32; .endef -__MINGW_USYMBOL(nearbyint): -#if defined(_AMD64_) || defined(__x86_64__) - movsd %xmm0,-16(%rsp) - fldl -16(%rsp) - pushq %rax - pushq %rcx - fnstcw (%rsp) - movq (%rsp), %rax - orq $0x20, %rax - movq %rax, 8(%rsp) - fldcw 8(%rsp) - frndint - fclex - fldcw (%rsp) - popq %rcx - popq %rax - fstpl -16(%rsp) - movsd -16(%rsp),%xmm0 - ret -#elif defined(_X86_) || defined(__i386__) - fldl 4(%esp) - pushl %eax - pushl %ecx - fnstcw (%esp) - movl (%esp), %eax - orl $0x20, %eax - movl %eax, 4(%esp) - fldcw 4(%esp) - frndint - fclex - fldcw (%esp) - popl %ecx - popl %eax - ret -#endif diff --git a/lib/libc/mingw/math/x86/nearbyintf.S b/lib/libc/mingw/math/x86/nearbyintf.S deleted file mode 100644 index 4be7124aca4d..000000000000 --- a/lib/libc/mingw/math/x86/nearbyintf.S +++ /dev/null @@ -1,51 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "nearbyintf.S" - .text -#ifdef __x86_64__ - .align 8 -#else - .align 4 -#endif - .globl __MINGW_USYMBOL(nearbyintf) - .def __MINGW_USYMBOL(nearbyintf); .scl 2; .type 32; .endef -__MINGW_USYMBOL(nearbyintf): -#if defined(_AMD64_) || defined(__x86_64__) - movss %xmm0,-12(%rsp) - flds -12(%rsp) - pushq %rax - pushq %rcx - fnstcw (%rsp) - movq (%rsp), %rax - orq $0x20, %rax - movq %rax, 8(%rsp) - fldcw 8(%rsp) - frndint - fclex - fldcw (%rsp) - popq %rcx - popq %rax - fstps -12(%rsp) - movss -12(%rsp),%xmm0 - ret -#elif defined(_X86_) || defined(__i386__) - flds 4(%esp) - pushl %eax - pushl %ecx - fnstcw (%esp) - movl (%esp), %eax - orl $0x20, %eax - movl %eax, 4(%esp) - fldcw 4(%esp) - frndint - fclex - fldcw (%esp) - popl %ecx - popl %eax - ret -#endif diff --git a/lib/libc/mingw/math/x86/pow.c b/lib/libc/mingw/math/x86/pow.c deleted file mode 100644 index 72a0f6eae7a2..000000000000 --- a/lib/libc/mingw/math/x86/pow.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - This Software is provided under the Zope Public License (ZPL) Version 2.1. - - Copyright (c) 2009, 2010 by the mingw-w64 project - - See the AUTHORS file for the list of contributors to the mingw-w64 project. - - This license has been certified as open source. It has also been designated - as GPL compatible by the Free Software Foundation (FSF). - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions in source code must retain the accompanying copyright - notice, this list of conditions, and the following disclaimer. - 2. Redistributions in binary form must reproduce the accompanying - copyright notice, this list of conditions, and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - 3. Names of the copyright holders must not be used to endorse or promote - products derived from this software without prior written permission - from the copyright holders. - 4. The right to distribute this software or to use it for any purpose does - not give you the right to use Servicemarks (sm) or Trademarks (tm) of - the copyright holders. Use of them is covered by separate agreement - with the copyright holders. - 5. If any files are modified, you must cause the modified files to carry - prominent notices stating that you changed the files and the date of - any change. - - Disclaimer - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define _NEW_COMPLEX_DOUBLE 1 -#include "pow.def.h" diff --git a/lib/libc/mingw/math/x86/remainder.S b/lib/libc/mingw/math/x86/remainder.S deleted file mode 100644 index 5a713f9040f7..000000000000 --- a/lib/libc/mingw/math/x86/remainder.S +++ /dev/null @@ -1,40 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "remainder.S" - .text -#ifdef __x86_64__ - .align 8 -#else - .align 4 -#endif -.globl __MINGW_USYMBOL(remainder) - .def __MINGW_USYMBOL(remainder); .scl 2; .type 32; .endef -__MINGW_USYMBOL(remainder): -#ifdef __x86_64__ - movsd %xmm0,-16(%rsp) - movsd %xmm1,-32(%rsp) - fldl -32(%rsp) - fldl -16(%rsp) -1: fprem1 - fstsw %ax - sahf - jp 1b - fstp %st(1) - fstpl -16(%rsp) - movsd -16(%rsp),%xmm0 - ret -#else - fldl 12(%esp) - fldl 4(%esp) -1: fprem1 - fstsw %ax - sahf - jp 1b - fstp %st(1) - ret -#endif diff --git a/lib/libc/mingw/math/x86/remainderf.S b/lib/libc/mingw/math/x86/remainderf.S deleted file mode 100644 index c3a3a3dc53f5..000000000000 --- a/lib/libc/mingw/math/x86/remainderf.S +++ /dev/null @@ -1,40 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "remainderf.S" - .text -#ifdef __x86_64__ - .align 8 -#else - .align 4 -#endif -.globl __MINGW_USYMBOL(remainder) - .def __MINGW_USYMBOL(remainderf); .scl 2; .type 32; .endef -__MINGW_USYMBOL(remainderf): -#ifdef __x86_64__ - movss %xmm1,-12(%rsp) - flds -12(%rsp) - movss %xmm0,-12(%rsp) - flds -12(%rsp) -1: fprem1 - fstsw %ax - sahf - jp 1b - fstp %st(1) - fstps -12(%rsp) - movss -12(%rsp),%xmm0 - ret -#else - flds 8(%esp) - flds 4(%esp) -1: fprem1 - fstsw %ax - sahf - jp 1b - fstp %st(1) - ret -#endif diff --git a/lib/libc/mingw/math/x86/remquo.S b/lib/libc/mingw/math/x86/remquo.S deleted file mode 100644 index e90d4926b4fc..000000000000 --- a/lib/libc/mingw/math/x86/remquo.S +++ /dev/null @@ -1,75 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "remquo.S" - .text -#ifdef __x86_64__ - .align 8 -#else - .align 4 -#endif -.globl __MINGW_USYMBOL(remquo) -__MINGW_USYMBOL(remquo): -#ifdef __x86_64__ - movsd %xmm1,-16(%rsp) - fldl -16(%rsp) - movsd %xmm0,-16(%rsp) - fldl -16(%rsp) -1: fprem1 - fstsw %ax - sahf - jp 1b - fstp %st(1) - movl %eax, %ecx - shrl $8, %eax - shrl $12, %ecx - andl $4, %ecx - andl $3, %eax - orl %eax, %ecx - leal (%ecx,%ecx,2),%ecx - movl $0xef2a60, %eax - shrl %cl, %eax - andl $7, %eax - movl -12(%rsp), %edx - movsd %xmm1,-16(%rsp) - xorl -12(%rsp), %edx - testl $0x80000000, %edx - jz 1f - negl %eax -1: movl %eax, (%r8) - - fstpl -16(%rsp) - movsd -16(%rsp),%xmm0 - ret -#else - fldl 4 +8(%esp) - fldl 4(%esp) -1: fprem1 - fstsw %ax - sahf - jp 1b - fstp %st(1) - movl %eax, %ecx - shrl $8, %eax - shrl $12, %ecx - andl $4, %ecx - andl $3, %eax - orl %eax, %ecx - leal (%ecx,%ecx,2),%ecx - movl $0xef2a60, %eax - shrl %cl, %eax - andl $7, %eax - movl 4 +8 +8(%esp), %ecx - movl 4 +4(%esp), %edx - xorl 4 +8 +4(%esp), %edx - testl $0x80000000, %edx - jz 1f - negl %eax -1: movl %eax, (%ecx) - - ret -#endif diff --git a/lib/libc/mingw/math/x86/remquof.S b/lib/libc/mingw/math/x86/remquof.S deleted file mode 100644 index b78de9742f58..000000000000 --- a/lib/libc/mingw/math/x86/remquof.S +++ /dev/null @@ -1,76 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "remquof.S" - .text -#ifdef __x86_64__ - .align 8 -#else - .align 4 -#endif -.globl __MINGW_USYMBOL(remquof) -__MINGW_USYMBOL(remquof): -#ifdef __x86_64__ - movss %xmm1,-12(%rsp) - flds -12(%rsp) - movss %xmm0,-12(%rsp) - flds -12(%rsp) -1: fprem1 - fstsw %ax - sahf - jp 1b - fstp %st(1) - movl %eax, %ecx - shrl $8, %eax - shrl $12, %ecx - andl $4, %ecx - andl $3, %eax - orl %eax, %ecx - movl $0xef2a60, %eax - leal (%ecx,%ecx,2),%ecx - shrl %cl, %eax - andl $7, %eax - movss %xmm0,-12(%rsp) - movl -12(%rsp), %edx - movss %xmm1,-12(%rsp) - xorl -12(%rsp), %edx - testl $0x80000000, %edx - jz 1f - negl %eax -1: movl %eax, (%r8) - - fstps -12(%rsp) - movss -12(%rsp),%xmm0 - ret -#else - flds 4 +4(%esp) - flds 4(%esp) -1: fprem1 - fstsw %ax - sahf - jp 1b - fstp %st(1) - movl %eax, %ecx - shrl $8, %eax - shrl $12, %ecx - andl $4, %ecx - andl $3, %eax - orl %eax, %ecx - movl $0xef2a60, %eax - leal (%ecx,%ecx,2),%ecx - shrl %cl, %eax - andl $7, %eax - movl 4 +4 +4(%esp), %ecx - movl 4(%esp), %edx - xorl 4 +4(%esp), %edx - testl $0x80000000, %edx - jz 1f - negl %eax -1: movl %eax, (%ecx) - - ret -#endif diff --git a/lib/libc/mingw/math/x86/rint.c b/lib/libc/mingw/math/x86/rint.c deleted file mode 100644 index 55a73d123213..000000000000 --- a/lib/libc/mingw/math/x86/rint.c +++ /dev/null @@ -1,12 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -double rint (double x) { - double retval = 0.0; - __asm__ __volatile__ ("frndint;" : "=t" (retval) : "0" (x)); - return retval; -} diff --git a/lib/libc/mingw/math/x86/rintf.c b/lib/libc/mingw/math/x86/rintf.c deleted file mode 100644 index f5a6bf2b112b..000000000000 --- a/lib/libc/mingw/math/x86/rintf.c +++ /dev/null @@ -1,12 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -float rintf (float x) { - float retval = 0.0F; - __asm__ __volatile__ ("frndint;": "=t" (retval) : "0" (x)); - return retval; -} diff --git a/lib/libc/mingw/math/x86/sin.c b/lib/libc/mingw/math/x86/sin.c deleted file mode 100644 index b32ed6e5c7aa..000000000000 --- a/lib/libc/mingw/math/x86/sin.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - This Software is provided under the Zope Public License (ZPL) Version 2.1. - - Copyright (c) 2009, 2010 by the mingw-w64 project - - See the AUTHORS file for the list of contributors to the mingw-w64 project. - - This license has been certified as open source. It has also been designated - as GPL compatible by the Free Software Foundation (FSF). - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions in source code must retain the accompanying copyright - notice, this list of conditions, and the following disclaimer. - 2. Redistributions in binary form must reproduce the accompanying - copyright notice, this list of conditions, and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - 3. Names of the copyright holders must not be used to endorse or promote - products derived from this software without prior written permission - from the copyright holders. - 4. The right to distribute this software or to use it for any purpose does - not give you the right to use Servicemarks (sm) or Trademarks (tm) of - the copyright holders. Use of them is covered by separate agreement - with the copyright holders. - 5. If any files are modified, you must cause the modified files to carry - prominent notices stating that you changed the files and the date of - any change. - - Disclaimer - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define _NEW_COMPLEX_DOUBLE 1 -#include "sin.def.h" diff --git a/lib/libc/mingw/math/x86/trunc.S b/lib/libc/mingw/math/x86/trunc.S deleted file mode 100644 index 4f1fa2b0d4ab..000000000000 --- a/lib/libc/mingw/math/x86/trunc.S +++ /dev/null @@ -1,91 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "trunc.S" - .text - .p2align 4,,15 - .globl __MINGW_USYMBOL(trunc) - .def __MINGW_USYMBOL(trunc); .scl 2; .type 32; .endef - -#ifdef __x86_64__ - .seh_proc __MINGW_USYMBOL(trunc) -#endif -__MINGW_USYMBOL(trunc): -#if defined(_AMD64_) || defined(__x86_64__) - subq $24, %rsp - .seh_stackalloc 24 - .seh_endprologue - movsd %xmm0, 8(%rsp) - movq 8(%rsp), %r8 - movq %r8, %rdx - shrq $32, %rdx - movl %edx, %eax - sarl $20, %eax - andl $2047, %eax - leal -1023(%rax), %ecx - cmpl $19, %ecx - jg .l1 - movl %edx, %r8d - andl $-2147483648, %r8d - testl %ecx, %ecx - js .l3 - movl $1048575, %eax - sarl %cl, %eax - notl %eax - andl %edx, %eax - orl %r8d, %eax - salq $32, %rax - movq %rax, 8(%rsp) - movsd 8(%rsp), %xmm0 - addq $24, %rsp - ret - .p2align 4,,10 -.l1: - cmpl $51, %ecx - jle .l2 - /* Is x inf/nan? */ - cmpl $1024, %ecx - jne .noinfnan - addsd %xmm0, %xmm0 -.noinfnan: - addq $24, %rsp - ret - .p2align 4,,10 -.l2: - leal -1043(%rax), %ecx - movl $-1, %r9d - salq $32, %rdx - shrl %cl, %r9d - notl %r9d - andl %r9d, %r8d - orq %r8, %rdx - movq %rdx, 8(%rsp) - movsd 8(%rsp), %xmm0 - addq $24, %rsp - ret - .p2align 4,,10 -.l3: - salq $32, %r8 - movq %r8, 8(%rsp) - movsd 8(%rsp), %xmm0 - addq $24, %rsp - ret - .seh_endproc -#elif defined(_X86_) || defined(__i386__) - fldl 4(%esp) - subl $8, %esp - fstcw (%esp) - /* FE_TOWARDZERO */ - movzwl (%esp), %eax - orb $0xc, %ah - movw %ax, 4(%esp) - fldcw 4(%esp) - frndint - fldcw (%esp) - addl $8, %esp - ret -#endif diff --git a/lib/libc/mingw/math/x86/truncf.S b/lib/libc/mingw/math/x86/truncf.S deleted file mode 100644 index 40a3a6ea90ef..000000000000 --- a/lib/libc/mingw/math/x86/truncf.S +++ /dev/null @@ -1,71 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include <_mingw_mac.h> - - .file "truncf.S" - .text - .p2align 4,,15 - .globl __MINGW_USYMBOL(truncf) - .def __MINGW_USYMBOL(truncf); .scl 2; .type 32; .endef - -#ifdef __x86_64__ - .seh_proc __MINGW_USYMBOL(truncf) -#endif -__MINGW_USYMBOL(truncf): -#if defined(_AMD64_) || defined(__x86_64__) - subq $24, %rsp - .seh_stackalloc 24 - .seh_endprologue - movd %xmm0, 12(%rsp) - movl 12(%rsp), %edx - movl %edx, %ecx - sarl $23, %ecx - andl $255, %ecx - subl $127, %ecx - cmpl $22, %ecx - jg .l1 - movl %edx, %r8d - andl $-2147483648, %r8d - testl %ecx, %ecx - js .l2 - movl $8388607, %eax - sarl %cl, %eax - notl %eax - andl %edx, %eax - orl %r8d, %eax - movl %eax, 8(%rsp) - movss 8(%rsp), %xmm0 - addq $24, %rsp - ret - .p2align 4,,10 -.l1: - addl $-128, %ecx - jne .noinfnan - addss %xmm0, %xmm0 -.noinfnan: - addq $24, %rsp - ret - .p2align 4,,10 -.l2: - movl %r8d, 8(%rsp) - movss 8(%rsp), %xmm0 - addq $24, %rsp - ret - .seh_endproc -#elif defined(_X86_) || defined(__i386__) - flds 4(%esp) - subl $8, %esp - fstcw (%esp) - /* FE_TOWARDZERO */ - movzwl (%esp), %eax - orb $0xc, %ah - movw %ax, 4(%esp) - fldcw 4(%esp) - frndint - fldcw (%esp) - addl $8, %esp - ret -#endif diff --git a/lib/libc/mingw/misc/___mb_cur_max_func.c b/lib/libc/mingw/misc/___mb_cur_max_func.c deleted file mode 100644 index 61dcdb7a6620..000000000000 --- a/lib/libc/mingw/misc/___mb_cur_max_func.c +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include <_mingw.h> - -extern int* __MINGW_IMP_SYMBOL(__mb_cur_max); - -int __cdecl ___mb_cur_max_func(void); -int __cdecl ___mb_cur_max_func(void) -{ - return *__MINGW_IMP_SYMBOL(__mb_cur_max); -} - -typedef int __cdecl (*_f___mb_cur_max_func)(void); -_f___mb_cur_max_func __MINGW_IMP_SYMBOL(___mb_cur_max_func) = ___mb_cur_max_func; diff --git a/lib/libc/mingw/misc/__p___argv.c b/lib/libc/mingw/misc/__p___argv.c deleted file mode 100644 index 8e1f8ed9ac76..000000000000 --- a/lib/libc/mingw/misc/__p___argv.c +++ /dev/null @@ -1,15 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -char ***__cdecl __p___argv(void) -{ - return __MINGW_IMP_SYMBOL(__argv); -} - -typedef char ***__cdecl (*_f__p___argv)(void); -_f__p___argv __MINGW_IMP_SYMBOL(__p___argv) = __p___argv; diff --git a/lib/libc/mingw/misc/__p__acmdln.c b/lib/libc/mingw/misc/__p__acmdln.c deleted file mode 100644 index 14e3868e5a60..000000000000 --- a/lib/libc/mingw/misc/__p__acmdln.c +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include <_mingw.h> - -extern char ** __MINGW_IMP_SYMBOL(_acmdln); - -char **__cdecl __p__acmdln(void); -char **__cdecl __p__acmdln(void) -{ - return __MINGW_IMP_SYMBOL(_acmdln); -} - -typedef char **__cdecl (*_f__p__acmdln)(void); -_f__p__acmdln __MINGW_IMP_SYMBOL(__p__acmdln) = __p__acmdln; diff --git a/lib/libc/mingw/misc/__p__commode.c b/lib/libc/mingw/misc/__p__commode.c deleted file mode 100644 index bd79f5af7d07..000000000000 --- a/lib/libc/mingw/misc/__p__commode.c +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include <_mingw.h> - -extern int * __MINGW_IMP_SYMBOL(_commode); - -int *__cdecl __p__commode(void); -int *__cdecl __p__commode(void) -{ - return __MINGW_IMP_SYMBOL(_commode); -} - -typeof(__p__commode) *__MINGW_IMP_SYMBOL(__p__commode) = __p__commode; diff --git a/lib/libc/mingw/misc/__p__fmode.c b/lib/libc/mingw/misc/__p__fmode.c deleted file mode 100644 index f788a6fcc93b..000000000000 --- a/lib/libc/mingw/misc/__p__fmode.c +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include <_mingw.h> - -extern int * __MINGW_IMP_SYMBOL(_fmode); - -int *__cdecl __p__fmode(void); -int *__cdecl __p__fmode(void) -{ - return __MINGW_IMP_SYMBOL(_fmode); -} - -typeof(__p__fmode) *__MINGW_IMP_SYMBOL(__p__fmode) = __p__fmode; diff --git a/lib/libc/mingw/misc/__p__wcmdln.c b/lib/libc/mingw/misc/__p__wcmdln.c deleted file mode 100644 index f34390468dfd..000000000000 --- a/lib/libc/mingw/misc/__p__wcmdln.c +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -extern wchar_t ** __MINGW_IMP_SYMBOL(_wcmdln); - -wchar_t **__cdecl __p__wcmdln(void); -wchar_t **__cdecl __p__wcmdln(void) -{ - return __MINGW_IMP_SYMBOL(_wcmdln); -} - -typedef wchar_t **__cdecl (*_f__p__wcmdln)(void); -_f__p__wcmdln __MINGW_IMP_SYMBOL(__p__wcmdln) = __p__wcmdln; diff --git a/lib/libc/mingw/misc/_configthreadlocale.c b/lib/libc/mingw/misc/_configthreadlocale.c deleted file mode 100644 index cbc60139bfc6..000000000000 --- a/lib/libc/mingw/misc/_configthreadlocale.c +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -int __cdecl _configthreadlocale(int flag) -{ - /* _ENABLE_PER_THREAD_LOCALE can't work on msvcrt.dll. */ - return flag == _ENABLE_PER_THREAD_LOCALE ? -1 : _DISABLE_PER_THREAD_LOCALE; -} - -void *__MINGW_IMP_SYMBOL(_configthreadlocale) = _configthreadlocale; - diff --git a/lib/libc/mingw/misc/_create_locale.c b/lib/libc/mingw/misc/_create_locale.c deleted file mode 100644 index 00947b3ac196..000000000000 --- a/lib/libc/mingw/misc/_create_locale.c +++ /dev/null @@ -1,33 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include -#include -#include - -static _locale_t __cdecl init_func(int category, const char *locale); -_locale_t (__cdecl *__MINGW_IMP_SYMBOL(_create_locale))(int, const char *) = init_func; - -static _locale_t __cdecl null_func(int category, const char *locale) -{ - (void)category; - (void)locale; - return NULL; -} - -static _locale_t __cdecl init_func(int category, const char *locale) -{ - HMODULE msvcrt = __mingw_get_msvcrt_handle(); - _locale_t (__cdecl *func)(int, const char *) = NULL; - - if (msvcrt) - func = (void*)GetProcAddress(msvcrt, "_create_locale"); - - if (!func) - func = null_func; - - return (__MINGW_IMP_SYMBOL(_create_locale) = func)(category, locale); -} diff --git a/lib/libc/mingw/misc/_free_locale.c b/lib/libc/mingw/misc/_free_locale.c deleted file mode 100644 index d94e2274fafb..000000000000 --- a/lib/libc/mingw/misc/_free_locale.c +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include -#include -#include - -static void __cdecl init_func(_locale_t locale); -void (__cdecl *__MINGW_IMP_SYMBOL(_free_locale))(_locale_t) = init_func; - -static void __cdecl stub_func(_locale_t locale) -{ - (void)locale; -} - -static void __cdecl init_func(_locale_t locale) -{ - HMODULE msvcrt = __mingw_get_msvcrt_handle(); - void (__cdecl *func)(_locale_t) = NULL; - - if (msvcrt) - func = (void*)GetProcAddress(msvcrt, "_free_locale"); - - if (!func) - func = stub_func; - - (__MINGW_IMP_SYMBOL(_free_locale) = func)(locale); -} diff --git a/lib/libc/mingw/misc/_get_current_locale.c b/lib/libc/mingw/misc/_get_current_locale.c deleted file mode 100644 index f5ccc4afc192..000000000000 --- a/lib/libc/mingw/misc/_get_current_locale.c +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include -#include - -static _locale_t __cdecl init_func(void); -_locale_t (__cdecl *__MINGW_IMP_SYMBOL(_get_current_locale))(void) = init_func; - -static _locale_t __cdecl null_func(void) -{ - return NULL; -} - -static _locale_t __cdecl init_func(void) -{ - HMODULE msvcrt = __mingw_get_msvcrt_handle(); - _locale_t (__cdecl *func)(void) = NULL; - - if (msvcrt) { - func = (void*)GetProcAddress(msvcrt, "_get_current_locale"); - } - - if (!func) - func = null_func; - - return (__MINGW_IMP_SYMBOL(_get_current_locale) = func)(); -} diff --git a/lib/libc/mingw/misc/imaxabs.c b/lib/libc/mingw/misc/imaxabs.c deleted file mode 100644 index 4f144a7ad56c..000000000000 --- a/lib/libc/mingw/misc/imaxabs.c +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -/* - This source code was extracted from the Q8 package created and - placed in the PUBLIC DOMAIN by Doug Gwyn - last edit: 1999/11/05 gwyn@arl.mil - - Implements subclause 7.8.2 of ISO/IEC 9899:1999 (E). - - This particular implementation requires the matching . -*/ -#define __CRT__NO_INLINE -#include - -intmax_t -__cdecl -imaxabs (intmax_t _j) - { return _j >= 0 ? _j : -_j; } -intmax_t (__cdecl *__MINGW_IMP_SYMBOL(imaxabs))(intmax_t) = imaxabs; - -long long __attribute__ ((alias ("imaxabs"))) __cdecl llabs (long long); -long long (__cdecl *__MINGW_IMP_SYMBOL(llabs))(long long) = llabs; - -__int64 __attribute__ ((alias ("imaxabs"))) __cdecl _abs64 (__int64); -__int64 (__cdecl *__MINGW_IMP_SYMBOL(_abs64))(__int64) = _abs64; diff --git a/lib/libc/mingw/misc/imaxdiv.c b/lib/libc/mingw/misc/imaxdiv.c deleted file mode 100644 index 7db911fa940c..000000000000 --- a/lib/libc/mingw/misc/imaxdiv.c +++ /dev/null @@ -1,35 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -/* - This source code was extracted from the Q8 package created and - placed in the PUBLIC DOMAIN by Doug Gwyn - last edit: 1999/11/05 gwyn@arl.mil - - - last edit: 1999/11/05 gwyn@arl.mil - - Implements subclause 7.8.2 of ISO/IEC 9899:1999 (E). - -*/ - -#include -#include - -imaxdiv_t -__cdecl -imaxdiv(intmax_t numer, intmax_t denom) -{ - imaxdiv_t result; - result.quot = numer / denom; - result.rem = numer % denom; - return result; -} -imaxdiv_t (__cdecl *__MINGW_IMP_SYMBOL(imaxdiv))(intmax_t, intmax_t) = imaxdiv; - -lldiv_t __attribute__ ((alias ("imaxdiv"))) -__cdecl -lldiv (long long, long long); -lldiv_t (__cdecl *__MINGW_IMP_SYMBOL(lldiv))(long long, long long) = lldiv; diff --git a/lib/libc/mingw/misc/invalid_parameter_handler.c b/lib/libc/mingw/misc/invalid_parameter_handler.c deleted file mode 100644 index 972b8598cbc0..000000000000 --- a/lib/libc/mingw/misc/invalid_parameter_handler.c +++ /dev/null @@ -1,23 +0,0 @@ -#define _CRTIMP -#include - -typedef void (__cdecl *_invalid_parameter_handler)(const wchar_t *,const wchar_t *,const wchar_t *,unsigned int,uintptr_t); -static _invalid_parameter_handler handler; - -static _invalid_parameter_handler __cdecl mingw_set_invalid_parameter_handler(_invalid_parameter_handler new_handler) -{ - return InterlockedExchangePointer((void**)&handler, new_handler); -} - -_invalid_parameter_handler (__cdecl *__MINGW_IMP_SYMBOL(_set_invalid_parameter_handler))(_invalid_parameter_handler) = - mingw_set_invalid_parameter_handler; - -static _invalid_parameter_handler __cdecl mingw_get_invalid_parameter_handler(void) -{ - return handler; -} - -_invalid_parameter_handler (__cdecl *__MINGW_IMP_SYMBOL(_get_invalid_parameter_handler))(void) = mingw_get_invalid_parameter_handler; - -_invalid_parameter_handler __cdecl _get_invalid_parameter_handler(void) __attribute__ ((alias ("mingw_get_invalid_parameter_handler"))); -_invalid_parameter_handler __cdecl _set_invalid_parameter_handler(_invalid_parameter_handler new_handler) __attribute__ ((alias ("mingw_set_invalid_parameter_handler"))); diff --git a/lib/libc/mingw/misc/lc_locale_func.c b/lib/libc/mingw/misc/lc_locale_func.c deleted file mode 100644 index 8f9ccd4b14e1..000000000000 --- a/lib/libc/mingw/misc/lc_locale_func.c +++ /dev/null @@ -1,59 +0,0 @@ -#define __lc_codepage __dummy_lc_codepage -#define ___lc_codepage_func __dummy____lc_codepage_func -#include -#include - -#undef __lc_codepage -#undef ___lc_codepage_func -#include "mb_wc_common.h" - -static unsigned int __cdecl setlocale_codepage_hack(void) -{ - /* locale :: "lang[_country[.code_page]]" | ".code_page" */ - const char *cp_str = strchr (setlocale(LC_CTYPE, NULL), '.'); - return cp_str ? atoi(cp_str + 1) : 0; -} - -#ifndef __LIBMSVCRT_OS__ - -unsigned int (__cdecl *__MINGW_IMP_SYMBOL(___lc_codepage_func))(void) = setlocale_codepage_hack; - -#else - -#include - -static unsigned int *msvcrt__lc_codepage; -static unsigned int __cdecl msvcrt___lc_codepage_func(void) -{ - return *msvcrt__lc_codepage; -} - -static unsigned int __cdecl init_codepage_func(void); -unsigned int (__cdecl *__MINGW_IMP_SYMBOL(___lc_codepage_func))(void) = init_codepage_func; - -static unsigned int __cdecl init_codepage_func(void) -{ - HMODULE msvcrt = __mingw_get_msvcrt_handle(); - unsigned int (__cdecl *func)(void) = NULL; - - if(msvcrt) { - func = (void*)GetProcAddress(msvcrt, "___lc_codepage_func"); - if(!func) { - msvcrt__lc_codepage = (unsigned int*)GetProcAddress(msvcrt, "__lc_codepage"); - if(msvcrt__lc_codepage) - func = msvcrt___lc_codepage_func; - } - } - - if(!func) - func = setlocale_codepage_hack; - - return (__MINGW_IMP_SYMBOL(___lc_codepage_func) = func)(); -} - -#endif - -unsigned int __cdecl ___lc_codepage_func(void) -{ - return __MINGW_IMP_SYMBOL(___lc_codepage_func)(); -} diff --git a/lib/libc/mingw/misc/mbrtowc.c b/lib/libc/mingw/misc/mbrtowc.c deleted file mode 100644 index 2eb480749f76..000000000000 --- a/lib/libc/mingw/misc/mbrtowc.c +++ /dev/null @@ -1,156 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include "mb_wc_common.h" -#include -#include -#include -#include - -static int __MINGW_ATTRIB_NONNULL(1) __MINGW_ATTRIB_NONNULL(4) -__mbrtowc_cp (wchar_t * __restrict__ pwc, const char * __restrict__ s, - size_t n, mbstate_t* __restrict__ ps, - const unsigned int cp, const unsigned int mb_max) -{ - union { - mbstate_t val; - char mbcs[4]; - } shift_state; - - /* Do the prelim checks */ - if (s == NULL) - return 0; - - if (n == 0) - /* The standard doesn't mention this case explicitly. Tell - caller that the conversion from a non-null s is incomplete. */ - return -2; - - /* Save the current shift state, in case we need it in DBCS case. */ - shift_state.val = *ps; - *ps = 0; - - if (!*s) - { - *pwc = 0; - return 0; - } - - if (mb_max > 1) - { - if (shift_state.mbcs[0] != 0) - { - /* Complete the mb char with the trailing byte. */ - shift_state.mbcs[1] = *s; /* the second byte */ - if (MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, - shift_state.mbcs, 2, pwc, 1) - == 0) - { - /* An invalid trailing byte */ - errno = EILSEQ; - return -1; - } - return 2; - } - else if (IsDBCSLeadByteEx (cp, *s)) - { - /* If told to translate one byte, just save the leadbyte - in *ps. */ - if (n < 2) - { - ((char*) ps)[0] = *s; - return -2; - } - /* Else translate the first two bytes */ - else if (MultiByteToWideChar (cp, MB_ERR_INVALID_CHARS, - s, 2, pwc, 1) - == 0) - { - errno = EILSEQ; - return -1; - } - return 2; - } - } - - /* Fall through to single byte char */ - if (cp == 0) - *pwc = (wchar_t)(unsigned char)*s; - - else if (MultiByteToWideChar (cp, MB_ERR_INVALID_CHARS, s, 1, pwc, 1) - == 0) - { - errno = EILSEQ; - return -1; - } - - return 1; -} - -size_t -mbrtowc (wchar_t * __restrict__ pwc, const char * __restrict__ s, - size_t n, mbstate_t* __restrict__ ps) -{ - static mbstate_t internal_mbstate = 0; - wchar_t byte_bucket = 0; - wchar_t* dst = pwc ? pwc : &byte_bucket; - - return (size_t) __mbrtowc_cp (dst, s, n, ps ? ps : &internal_mbstate, - ___lc_codepage_func(), MB_CUR_MAX); -} - - -size_t -mbsrtowcs (wchar_t* __restrict__ dst, const char ** __restrict__ src, - size_t len, mbstate_t* __restrict__ ps) -{ - int ret =0 ; - size_t n = 0; - static mbstate_t internal_mbstate = 0; - mbstate_t* internal_ps = ps ? ps : &internal_mbstate; - const unsigned int cp = ___lc_codepage_func(); - const unsigned int mb_max = MB_CUR_MAX; - - if (src == NULL || *src == NULL) /* undefined behavior */ - return 0; - - if (dst != NULL) - { - while (n < len - && (ret = __mbrtowc_cp(dst, *src, len - n, - internal_ps, cp, mb_max)) - > 0) - { - ++dst; - *src += ret; - n += ret; - } - - if (n < len && ret == 0) - *src = (char *)NULL; - } - else - { - wchar_t byte_bucket = 0; - while ((ret = __mbrtowc_cp (&byte_bucket, *src + n, mb_max, - internal_ps, cp, mb_max)) - > 0) - n += ret; - } - return n; -} - -size_t -mbrlen (const char * __restrict__ s, size_t n, - mbstate_t * __restrict__ ps) -{ - static mbstate_t s_mbstate = 0; - wchar_t byte_bucket = 0; - return __mbrtowc_cp (&byte_bucket, s, n, (ps) ? ps : &s_mbstate, - ___lc_codepage_func(), MB_CUR_MAX); -} diff --git a/lib/libc/mingw/misc/mbsinit.c b/lib/libc/mingw/misc/mbsinit.c deleted file mode 100644 index d745402d7d61..000000000000 --- a/lib/libc/mingw/misc/mbsinit.c +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -/* This source code was extracted from the Q8 package created and placed - in the PUBLIC DOMAIN by Doug Gwyn - last edit: 1999/11/05 gwyn@arl.mil - - Implements subclause 7.24 of ISO/IEC 9899:1999 (E). - - It supports an encoding where all char codes are mapped - to the *same* code values within a wchar_t or wint_t, - so long as no other wchar_t codes are used by the program. - -*/ - -#define __CRT__NO_INLINE -#include - -#if 0 -int mbsinit(const mbstate_t *ps) -{ - return 1; /* don't have shift states */ -} -#endif - -int __cdecl mbsinit(const mbstate_t *_P) -{ - return (!_P || *_P == 0); -} - diff --git a/lib/libc/mingw/misc/onexit_table.c b/lib/libc/mingw/misc/onexit_table.c deleted file mode 100644 index 69f2ea716678..000000000000 --- a/lib/libc/mingw/misc/onexit_table.c +++ /dev/null @@ -1,77 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include -#include - -#define _EXIT_LOCK1 8 - -void __cdecl _lock (int _File); -void __cdecl _unlock (int _File); - -int __cdecl _initialize_onexit_table(_onexit_table_t *table) -{ - if (!table) return -1; - table->_first = table->_last = table->_end = NULL; - return 0; -} - -int __cdecl _register_onexit_function(_onexit_table_t *table, _onexit_t func) -{ - if (!table) return -1; - - _lock(_EXIT_LOCK1); - - if (!table->_first) { - table->_first = calloc(32, sizeof(void*)); - if (!table->_first) { - _unlock(_EXIT_LOCK1); - return -1; - } - table->_last = table->_first; - table->_end = table->_first + 32; - } - - if (table->_last == table->_end) { - size_t len = table->_end - table->_first; - _PVFV *new_buf = realloc(table->_first, len * sizeof(void*) * 2); - if (!new_buf) { - _unlock(_EXIT_LOCK1); - return -1; - } - table->_first = new_buf; - table->_last = new_buf + len; - table->_end = new_buf + len * 2; - } - - *table->_last++ = (_PVFV)func; - _unlock(_EXIT_LOCK1); - return 0; -} - -int __cdecl _execute_onexit_table(_onexit_table_t *table) -{ - _PVFV *first, *last; - - _lock(_EXIT_LOCK1); - first = table->_first; - last = table->_last; - _initialize_onexit_table(table); - _unlock(_EXIT_LOCK1); - - if (!first) return 0; - - while (--last >= first) - if (*last) - (**last)(); - - free(first); - return 0; -} - -typeof(_initialize_onexit_table) *__MINGW_IMP_SYMBOL(_initialize_onexit_table) = _initialize_onexit_table; -typeof(_register_onexit_function) *__MINGW_IMP_SYMBOL(_register_onexit_function) = _register_onexit_function; -typeof(_execute_onexit_table) *__MINGW_IMP_SYMBOL(_execute_onexit_table) = _execute_onexit_table; diff --git a/lib/libc/mingw/misc/output_format.c b/lib/libc/mingw/misc/output_format.c deleted file mode 100644 index da037556c9ca..000000000000 --- a/lib/libc/mingw/misc/output_format.c +++ /dev/null @@ -1,62 +0,0 @@ -#define _get_output_format __dummy__get_output_format -#define _set_output_format __dummy__set_output_format -#include -#include - -#undef _get_output_format -#undef _set_output_format - -static unsigned int last_value = 0; -typedef unsigned int (*f_get_output_format)(void); -typedef unsigned int (*f_set_output_format)(unsigned int); - -static unsigned int init_set_output_format(unsigned int); -f_set_output_format __MINGW_IMP_SYMBOL(_set_output_format) = init_set_output_format; - -unsigned int _set_output_format(unsigned int format); -unsigned int _set_output_format(unsigned int format) -{ - return __MINGW_IMP_SYMBOL(_set_output_format)(format); -} - -static unsigned int fake_set_output_format(unsigned int value) -{ - return InterlockedExchange((LONG*)&last_value, value); -} - -static unsigned int init_set_output_format(unsigned int format) -{ - f_set_output_format sof; - - sof = (f_set_output_format) GetProcAddress (__mingw_get_msvcrt_handle(), "_set_output_format"); - if(!sof) - sof = fake_set_output_format; - - return (__MINGW_IMP_SYMBOL(_set_output_format) = sof)(format); -} - - -static unsigned int init_get_output_format(void); -f_get_output_format __MINGW_IMP_SYMBOL(_get_output_format) = init_get_output_format; - -unsigned int _get_output_format(void); -unsigned int _get_output_format(void) -{ - return __MINGW_IMP_SYMBOL(_get_output_format)(); -} - -static unsigned int fake_get_output_format(void) -{ - return last_value; -} - -static unsigned int init_get_output_format(void) -{ - f_get_output_format gof; - - gof = (f_get_output_format) GetProcAddress (__mingw_get_msvcrt_handle(), "_get_output_format"); - if(!gof) - gof = fake_get_output_format; - - return (__MINGW_IMP_SYMBOL(_get_output_format) = gof)(); -} diff --git a/lib/libc/mingw/misc/purecall.c b/lib/libc/mingw/misc/purecall.c deleted file mode 100644 index 8c29e6760928..000000000000 --- a/lib/libc/mingw/misc/purecall.c +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#define _CRTIMP -#include -#include - -_purecall_handler __cdecl _set_purecall_handler(_purecall_handler handler) -{ - static _purecall_handler prev_handler; - return InterlockedExchangePointer((void**)&prev_handler, handler); -} - -void *__MINGW_IMP_SYMBOL(_set_purecall_handler) = _set_purecall_handler; - diff --git a/lib/libc/mingw/misc/register_tls_atexit.c b/lib/libc/mingw/misc/register_tls_atexit.c deleted file mode 100644 index 09d9270e4dd4..000000000000 --- a/lib/libc/mingw/misc/register_tls_atexit.c +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include -#include -#include -#include - -static _tls_callback_type callback; - -static void run_callback(void) -{ - if (callback) - callback(NULL, DLL_PROCESS_DETACH, 0); - callback = NULL; -} - -void __cdecl _register_thread_local_exe_atexit_callback(_tls_callback_type cb) -{ - callback = cb; - /* This should guarantee that the callback is called. It won't be run in the - * exact right spot as intended to, but it will be run. */ - atexit(run_callback); -} - -typeof(_register_thread_local_exe_atexit_callback) *__MINGW_IMP_SYMBOL(_register_thread_local_exe_atexit_callback) = _register_thread_local_exe_atexit_callback; diff --git a/lib/libc/mingw/misc/seterrno.c b/lib/libc/mingw/misc/seterrno.c deleted file mode 100644 index ab54c668f74a..000000000000 --- a/lib/libc/mingw/misc/seterrno.c +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -errno_t __cdecl _set_errno (int _Value) -{ - errno = _Value; - return 0; -} - -errno_t __cdecl _get_errno (int *_Value) -{ - if(!_Value) - { - errno = EINVAL; - return EINVAL; - } - - *_Value = errno; - return 0; -} diff --git a/lib/libc/mingw/misc/strtoimax.c b/lib/libc/mingw/misc/strtoimax.c deleted file mode 100644 index 7f09869cb0b1..000000000000 --- a/lib/libc/mingw/misc/strtoimax.c +++ /dev/null @@ -1,123 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -/* - This source code was extracted from the Q8 package created and - placed in the PUBLIC DOMAIN by Doug Gwyn - last edit: 1999/11/05 gwyn@arl.mil - - Implements subclause 7.8.2 of ISO/IEC 9899:1999 (E). - - This particular implementation requires the matching . - It also assumes that character codes for A..Z and a..z are in - contiguous ascending order; this is true for ASCII but not EBCDIC. -*/ -#include -#include -#include -#include - -/* Helper macros */ - -/* convert digit character to number, in any base */ -#define ToNumber(c) (isdigit(c) ? (c) - '0' : \ - isupper(c) ? (c) - 'A' + 10 : \ - islower(c) ? (c) - 'a' + 10 : \ - -1 /* "invalid" flag */ \ - ) -/* validate converted digit character for specific base */ -#define valid(n, b) ((n) >= 0 && (n) < (b)) - -intmax_t -__cdecl -strtoimax(const char * __restrict__ nptr, char ** __restrict__ endptr, int base) - { - register uintmax_t accum; /* accumulates converted value */ - register int n; /* numeral from digit character */ - int minus; /* set iff minus sign seen */ - int toobig; /* set iff value overflows */ - - if ( endptr != NULL ) - *endptr = (char *)nptr; /* in case no conversion's performed */ - - if ( base < 0 || base == 1 || base > 36 ) - { - errno = EDOM; - return 0; /* unspecified behavior */ - } - - /* skip initial, possibly empty sequence of white-space characters */ - - while ( isspace(*nptr) ) - ++nptr; - - /* process subject sequence: */ - - /* optional sign */ - if ( (minus = *nptr == '-') || *nptr == '+' ) - ++nptr; - - if ( base == 0 ) { - if ( *nptr == '0' ) { - if ( nptr[1] == 'X' || nptr[1] == 'x' ) - base = 16; - else - base = 8; - } - else - base = 10; - } - /* optional "0x" or "0X" for base 16 */ - - if ( base == 16 && *nptr == '0' && (nptr[1] == 'X' || nptr[1] == 'x') ) - nptr += 2; /* skip past this prefix */ - - /* check whether there is at least one valid digit */ - - n = ToNumber(*nptr); - ++nptr; - - if ( !valid(n, base) ) - return 0; /* subject seq. not of expected form */ - - accum = n; - - for ( toobig = 0; n = ToNumber(*nptr), valid(n, base); ++nptr ) - if ( accum > (uintmax_t)(INTMAX_MAX / base + 2) ) /* major wrap-around */ - toobig = 1; /* but keep scanning */ - else - accum = base * accum + n; - - if ( endptr != NULL ) - *endptr = (char *)nptr; /* points to first not-valid-digit */ - - if ( minus ) - { - if ( accum > (uintmax_t)INTMAX_MAX + 1 ) - toobig = 1; - } - else - if ( accum > (uintmax_t)INTMAX_MAX ) - toobig = 1; - - if ( toobig ) - { - errno = ERANGE; - return minus ? INTMAX_MIN : INTMAX_MAX; - } - else - return (intmax_t)(minus ? -accum : accum); - } -intmax_t (__cdecl *__MINGW_IMP_SYMBOL(strtoimax))(const char* __restrict__, char ** __restrict__, int) = strtoimax; - -long long __attribute__ ((alias ("strtoimax"))) -__cdecl -strtoll (const char* __restrict__ nptr, char ** __restrict__ endptr, int base); -long long (__cdecl *__MINGW_IMP_SYMBOL(strtoll))(const char* __restrict__, char ** __restrict__, int) = strtoll; - -__int64 __attribute__ ((alias ("strtoimax"))) -__cdecl -_strtoi64 (const char* __restrict__ nptr, char ** __restrict__ endptr, int base); -__int64 (__cdecl *__MINGW_IMP_SYMBOL(_strtoi64))(const char* __restrict__, char ** __restrict__, int) = _strtoi64; diff --git a/lib/libc/mingw/misc/strtoumax.c b/lib/libc/mingw/misc/strtoumax.c deleted file mode 100644 index d47a7c90d8f1..000000000000 --- a/lib/libc/mingw/misc/strtoumax.c +++ /dev/null @@ -1,121 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -/* - This source code was extracted from the Q8 package created and - placed in the PUBLIC DOMAIN by Doug Gwyn - last edit: 1999/11/05 gwyn@arl.mil - - Implements subclause 7.8.2 of ISO/IEC 9899:1999 (E). - - This particular implementation requires the matching . - It also assumes that character codes for A..Z and a..z are in - contiguous ascending order; this is true for ASCII but not EBCDIC. -*/ -#include -#include -#include -#include - -/* Helper macros */ - -/* convert digit character to number, in any base */ -#define ToNumber(c) (isdigit(c) ? (c) - '0' : \ - isupper(c) ? (c) - 'A' + 10 : \ - islower(c) ? (c) - 'a' + 10 : \ - -1 /* "invalid" flag */ \ - ) -/* validate converted digit character for specific base */ -#define valid(n, b) ((n) >= 0 && (n) < (b)) - -uintmax_t -__cdecl -strtoumax(const char * __restrict__ nptr, char ** __restrict__ endptr, int base) - { - register uintmax_t accum; /* accumulates converted value */ - register uintmax_t next; /* for computing next value of accum */ - register int n; /* numeral from digit character */ - int minus; /* set iff minus sign seen (yes!) */ - int toobig; /* set iff value overflows */ - - if ( endptr != NULL ) - *endptr = (char *)nptr; /* in case no conversion's performed */ - - if ( base < 0 || base == 1 || base > 36 ) - { - errno = EDOM; - return 0; /* unspecified behavior */ - } - - /* skip initial, possibly empty sequence of white-space characters */ - - while ( isspace(*nptr) ) - ++nptr; - - /* process subject sequence: */ - - /* optional sign (yes!) */ - - if ( (minus = *nptr == '-') || *nptr == '+' ) - ++nptr; - - if ( base == 0 ) - { - if ( *nptr == '0' ) - { - if ( nptr[1] == 'X' || nptr[1] == 'x' ) - base = 16; - else - base = 8; - } - else - base = 10; - } - - /* optional "0x" or "0X" for base 16 */ - - if ( base == 16 && *nptr == '0' && (nptr[1] == 'X' || nptr[1] == 'x') ) - nptr += 2; /* skip past this prefix */ - - /* check whether there is at least one valid digit */ - - n = ToNumber(*nptr); - ++nptr; - - if ( !valid(n, base) ) - return 0; /* subject seq. not of expected form */ - - accum = n; - - for ( toobig = 0; n = ToNumber(*nptr), valid(n, base); ++nptr ) - if ( accum > UINTMAX_MAX / base + 1 /* major wrap-around */ - || (next = base * accum + n) < accum /* minor wrap-around */ - ) - toobig = 1; /* but keep scanning */ - else - accum = next; - - if ( endptr != NULL ) - *endptr = (char *)nptr; /* points to first not-valid-digit */ - - if ( toobig ) - { - errno = ERANGE; - return UINTMAX_MAX; - } - else - return minus ? -accum : accum; /* (yes!) */ - } -uintmax_t (__cdecl *__MINGW_IMP_SYMBOL(strtoumax))(const char* __restrict__, char ** __restrict__, int) = strtoumax; - -unsigned long long __attribute__ ((alias ("strtoumax"))) -__cdecl -strtoull (const char* __restrict__ nptr, char ** __restrict__ endptr, int base); -unsigned long long (__cdecl *__MINGW_IMP_SYMBOL(strtoull))(const char* __restrict__, char ** __restrict__, int) = strtoull; - -unsigned __int64 __attribute__ ((alias ("strtoumax"))) -__cdecl -_strtoui64 (const char* __restrict__ nptr, char ** __restrict__ endptr, int base); -unsigned __int64 (__cdecl *__MINGW_IMP_SYMBOL(_strtoui64))(const char* __restrict__, char ** __restrict__, int) = _strtoui64; diff --git a/lib/libc/mingw/misc/wassert.c b/lib/libc/mingw/misc/wassert.c deleted file mode 100644 index 2fdd5e29a523..000000000000 --- a/lib/libc/mingw/misc/wassert.c +++ /dev/null @@ -1,49 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include -#include -#include -#include "msvcrt.h" - -/* _wassert is not available on XP, so forward it to _assert if needed */ -static void __cdecl mingw_wassert(const wchar_t *_Message, const wchar_t *_File, unsigned _Line) -{ - char *message = NULL, *file = NULL; - size_t len; - - if ((len = wcstombs(NULL, _Message, 0)) != (size_t)-1) - { - message = malloc(len + 1); - wcstombs(message, _Message, len + 1); - } - - if ((len = wcstombs(NULL, _File, 0)) != (size_t)-1) - { - file = malloc(len + 1); - wcstombs(file, _File, len + 1); - } - - _assert(message, file, _Line); - - free(message); - free(file); -} - -static void __cdecl init_wassert(const wchar_t *message, const wchar_t *file, unsigned line); - -void (__cdecl *__MINGW_IMP_SYMBOL(_wassert))(const wchar_t*, const wchar_t*,unsigned) = init_wassert; - -static void __cdecl init_wassert(const wchar_t *message, const wchar_t *file, unsigned line) -{ - void *func; - - func = (void*)GetProcAddress(__mingw_get_msvcrt_handle(), "_wassert"); - if(!func) - func = mingw_wassert; - - return (__MINGW_IMP_SYMBOL(_wassert) = func)(message, file, line); -} diff --git a/lib/libc/mingw/misc/wcrtomb.c b/lib/libc/mingw/misc/wcrtomb.c deleted file mode 100644 index e96d061d0916..000000000000 --- a/lib/libc/mingw/misc/wcrtomb.c +++ /dev/null @@ -1,100 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include "mb_wc_common.h" -#include -#include -#include -#include -#include - -__attribute__((noinline)) -static int __MINGW_ATTRIB_NONNULL(1) - __wcrtomb_cp (char *dst, wchar_t wc, const unsigned int cp, - const unsigned int mb_max) -{ - if (cp == 0) - { - if (wc > 255) - { - errno = EILSEQ; - return -1; - } - *dst = (char) wc; - return 1; - } - else - { - int invalid_char = 0; - - int size = WideCharToMultiByte (cp, 0 /* Is this correct flag? */, - &wc, 1, dst, mb_max, - NULL, &invalid_char); - if (size == 0 || invalid_char) - { - errno = EILSEQ; - return -1; - } - return size; - } -} - -size_t -wcrtomb (char *dst, wchar_t wc, mbstate_t * __UNUSED_PARAM (ps)) -{ - char byte_bucket [MB_LEN_MAX]; - char* tmp_dst = dst ? dst : &byte_bucket[0]; - return (size_t)__wcrtomb_cp (tmp_dst, wc, ___lc_codepage_func(), - MB_CUR_MAX); -} - -size_t wcsrtombs (char *dst, const wchar_t **src, size_t len, - mbstate_t * __UNUSED_PARAM (ps)) -{ - int ret = 0; - size_t n = 0; - const unsigned int cp = ___lc_codepage_func(); - const unsigned int mb_max = MB_CUR_MAX; - const wchar_t *pwc = *src; - - if (src == NULL || *src == NULL) /* undefined behavior */ - return 0; - - if (dst != NULL) - { - while (n < len) - { - if ((ret = __wcrtomb_cp (dst, *pwc, cp, mb_max)) <= 0) - return (size_t) -1; - n += ret; - dst += ret; - if (*(dst - 1) == '\0') - { - *src = (wchar_t *) NULL; - return (n - 1); - } - pwc++; - } - *src = pwc; - } - else - { - char byte_bucket [MB_LEN_MAX]; - while (1) - { - if ((ret = __wcrtomb_cp (&byte_bucket[0], *pwc, cp, mb_max)) <= 0) - return (size_t) -1; - n += ret; - if (byte_bucket [ret - 1] == '\0') - return (n - 1); - pwc++; - } - } - - return n; -} diff --git a/lib/libc/mingw/secapi/_access_s.c b/lib/libc/mingw/secapi/_access_s.c deleted file mode 100644 index 9be582e8787b..000000000000 --- a/lib/libc/mingw/secapi/_access_s.c +++ /dev/null @@ -1,46 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_access_s (const char *, int); -static errno_t __cdecl _stub (const char *, int); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(_access_s))(const char *, int) = - _stub; - -static errno_t __cdecl -_stub (const char *s, int m) -{ - errno_t __cdecl (*f)(const char *, int) = __MINGW_IMP_SYMBOL(_access_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(const char *, int)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_access_s"); - if (!f) - f = _int_access_s; - __MINGW_IMP_SYMBOL(_access_s) = f; - } - return (*f)(s, m); -} - -errno_t __cdecl -_access_s (const char *s, int m) -{ - return _stub (s, m); -} - -static errno_t __cdecl -_int_access_s (const char *s, int m) -{ - if (!s || (m & ~6) != 0) - { - _access (NULL, m); - return EINVAL; - } - if (!_access (s, m)) - return 0; - return errno; -} diff --git a/lib/libc/mingw/secapi/_cgets_s.c b/lib/libc/mingw/secapi/_cgets_s.c deleted file mode 100644 index f81623a9a9fd..000000000000 --- a/lib/libc/mingw/secapi/_cgets_s.c +++ /dev/null @@ -1,55 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_cgets_s (char *, size_t, size_t *); -static errno_t __cdecl _stub (char *, size_t, size_t *); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(_cgets_s))(char *, size_t, size_t *) = - _stub; - -static errno_t __cdecl -_stub (char *s, size_t l, size_t *r_len) -{ - errno_t __cdecl (*f)(char *, size_t, size_t *) = __MINGW_IMP_SYMBOL(_cgets_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(char *, size_t, size_t *)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_cgets_s"); - if (!f) - f = _int_cgets_s; - __MINGW_IMP_SYMBOL(_cgets_s) = f; - } - return (*f)(s, l, r_len); -} - -errno_t __cdecl -_cgets_s (char *s, size_t l, size_t *r_len) -{ - return _stub (s, l, r_len); -} - -static errno_t __cdecl -_int_cgets_s (char *s, size_t l, size_t *r_len) -{ - char *h, *p; - - if (s && l) - s[0] = 0; - if (!s || !l || !r_len) - { - _cgets (NULL); - return EINVAL; - } - p = (char *) alloca (l + 2); - p[0] = l; - h = _cgets (s); - if (!h) - return EINVAL; - *r_len = (size_t) p[1]; - memcpy (s, &p[2], *r_len); - return 0; -} diff --git a/lib/libc/mingw/secapi/_cgetws_s.c b/lib/libc/mingw/secapi/_cgetws_s.c deleted file mode 100644 index 01ee3d1b32ba..000000000000 --- a/lib/libc/mingw/secapi/_cgetws_s.c +++ /dev/null @@ -1,55 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_cgetws_s (wchar_t *, size_t, size_t *); -static errno_t __cdecl _stub (wchar_t *, size_t, size_t *); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(_cgetws_s))(wchar_t *, size_t, size_t *) = - _stub; - -static errno_t __cdecl -_stub (wchar_t *s, size_t l, size_t *r_len) -{ - errno_t __cdecl (*f)(wchar_t *, size_t, size_t *) = __MINGW_IMP_SYMBOL(_cgetws_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(wchar_t *, size_t, size_t *)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_cgetws_s"); - if (!f) - f = _int_cgetws_s; - __MINGW_IMP_SYMBOL(_cgetws_s) = f; - } - return (*f)(s, l, r_len); -} - -errno_t __cdecl -_cgetws_s (wchar_t *s, size_t l, size_t *r_len) -{ - return _stub (s, l, r_len); -} - -static errno_t __cdecl -_int_cgetws_s (wchar_t *s, size_t l, size_t *r_len) -{ - wchar_t *h, *p; - - if (s && l) - s[0] = 0; - if (!s || !l || !r_len) - { - _cgetws (NULL); - return EINVAL; - } - p = (wchar_t *) alloca ((l + 2) * sizeof (wchar_t)); - p[0] = l; - h = _cgetws (s); - if (!h) - return EINVAL; - *r_len = (size_t) p[1]; - memcpy (s, &p[2], *r_len); - return 0; -} diff --git a/lib/libc/mingw/secapi/_chsize_s.c b/lib/libc/mingw/secapi/_chsize_s.c deleted file mode 100644 index cd8d066ebb94..000000000000 --- a/lib/libc/mingw/secapi/_chsize_s.c +++ /dev/null @@ -1,46 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_chsize_s (int, long long); -static errno_t __cdecl _stub (int, long long); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(_chsize_s))(int, long long) = - _stub; - -static errno_t __cdecl -_stub (int fd, long long sz) -{ - errno_t __cdecl (*f)(int, long long) = __MINGW_IMP_SYMBOL(_chsize_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(int, long long)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_chsize_s"); - if (!f) - f = _int_chsize_s; - __MINGW_IMP_SYMBOL(_chsize_s) = f; - } - return (*f)(fd, sz); -} - -errno_t __cdecl -_chsize_s (int fd, long long sz) -{ - return _stub (fd, sz); -} - -static errno_t __cdecl -_int_chsize_s (int fd, long long sz) -{ - if (sz > 0x7fffffffll) - { - /* We can't set file bigger as 2GB, so return EACCES. */ - return (errno = EACCES); - } - if (!_chsize (fd, sz)) - return 0; - return errno; -} diff --git a/lib/libc/mingw/secapi/_controlfp_s.c b/lib/libc/mingw/secapi/_controlfp_s.c deleted file mode 100644 index 32be17cfb83e..000000000000 --- a/lib/libc/mingw/secapi/_controlfp_s.c +++ /dev/null @@ -1,56 +0,0 @@ -#include -#include -#include -#include - -static errno_t __cdecl _stub( - unsigned int *currentControl, - unsigned int newControl, - unsigned int mask -); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(_controlfp_s))(unsigned int *, unsigned int, unsigned int) = _stub; - -errno_t __cdecl _controlfp_s( - unsigned int *currentControl, - unsigned int newControl, - unsigned int mask -){ - return __MINGW_IMP_SYMBOL(_controlfp_s)(currentControl,newControl,mask); -} - -static const unsigned int allflags = _MCW_DN | _MCW_EM | _MCW_IC | _MCW_RC | _MCW_PC; -static errno_t __cdecl _int_controlfp_s( - unsigned int *currentControl, - unsigned int newControl, - unsigned int mask -){ - unsigned int cont; - if(!(newControl & mask & ~allflags)){ - if (currentControl) *currentControl = _controlfp( 0, 0 ); - return EINVAL; - } - cont = _controlfp( newControl, mask ); - if(currentControl) *currentControl = cont; - return 0; -} - -static errno_t __cdecl _stub ( - unsigned int *currentControl, - unsigned int newControl, - unsigned int mask -) -{ - errno_t __cdecl (*f)(unsigned int *, unsigned int, unsigned int) = __MINGW_IMP_SYMBOL(_controlfp_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(unsigned int *, unsigned int, unsigned int)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_controlfp_s"); - if (!f) - f = _int_controlfp_s; - __MINGW_IMP_SYMBOL(_controlfp_s) = f; - } - return (*f)(currentControl, newControl, mask); -} - diff --git a/lib/libc/mingw/secapi/_cprintf_s.c b/lib/libc/mingw/secapi/_cprintf_s.c deleted file mode 100644 index eef77df415a9..000000000000 --- a/lib/libc/mingw/secapi/_cprintf_s.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include -#include -#include -#include - -int __cdecl (*__MINGW_IMP_SYMBOL(_cprintf_s))(const char *,...) = - _cprintf_s; - -int __cdecl -_cprintf_s (const char *s, ...) -{ - va_list argp; - int r; - - va_start (argp, s); - r = _vcprintf_s (s, argp); - va_end (argp); - return r; -} diff --git a/lib/libc/mingw/secapi/_cprintf_s_l.c b/lib/libc/mingw/secapi/_cprintf_s_l.c deleted file mode 100644 index cce1d51b53da..000000000000 --- a/lib/libc/mingw/secapi/_cprintf_s_l.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include -#include -#include -#include - -int __cdecl (*__MINGW_IMP_SYMBOL(_cprintf_s_l))(const char *, _locale_t, ...) = - _cprintf_s_l; - -int __cdecl -_cprintf_s_l (const char *s, _locale_t loc, ...) -{ - va_list argp; - int r; - - va_start (argp, loc); - r = _vcprintf_s_l (s, loc, argp); - va_end (argp); - return r; -} diff --git a/lib/libc/mingw/secapi/_ctime32_s.c b/lib/libc/mingw/secapi/_ctime32_s.c deleted file mode 100644 index c59ccfc190a5..000000000000 --- a/lib/libc/mingw/secapi/_ctime32_s.c +++ /dev/null @@ -1,56 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_ctime32_s (char *, size_t, const __time32_t *); -static errno_t __cdecl _stub (char *, size_t, const __time32_t *); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(_ctime32_s))(char *, size_t, const __time32_t *) = - _stub; - -static errno_t __cdecl -_stub (char *d, size_t dn, const __time32_t *pt) -{ - errno_t __cdecl (*f)(char *, size_t, const __time32_t *) = __MINGW_IMP_SYMBOL(_ctime32_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(char *, size_t, const __time32_t *)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_ctime32_s"); - if (!f) - f = _int_ctime32_s; - __MINGW_IMP_SYMBOL(_ctime32_s) = f; - } - return (*f)(d, dn, pt); -} - -errno_t __cdecl -_ctime32_s (char *d, size_t dn, const __time32_t *pt) -{ - return _stub (d, dn, pt); -} - -static errno_t __cdecl -_int_ctime32_s (char *d, size_t dn, const __time32_t *pt) -{ - struct tm ltm; - errno_t e; - - if (!d || !dn) - { - errno = EINVAL; - return EINVAL; - } - d[0] = 0; - if (!pt) - { - errno = EINVAL; - return EINVAL; - } - - if ((e = _localtime32_s (<m, pt)) != 0) - return e; - return asctime_s (d, dn, <m); -} diff --git a/lib/libc/mingw/secapi/_ctime64_s.c b/lib/libc/mingw/secapi/_ctime64_s.c deleted file mode 100644 index 833d14a0aa6a..000000000000 --- a/lib/libc/mingw/secapi/_ctime64_s.c +++ /dev/null @@ -1,56 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_ctime64_s (char *, size_t, const __time64_t *); -static errno_t __cdecl _stub (char *, size_t, const __time64_t *); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(_ctime64_s))(char *, size_t, const __time64_t *) = - _stub; - -static errno_t __cdecl -_stub (char *d, size_t dn, const __time64_t *pt) -{ - errno_t __cdecl (*f)(char *, size_t, const __time64_t *) = __MINGW_IMP_SYMBOL(_ctime64_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(char *, size_t, const __time64_t *)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_ctime64_s"); - if (!f) - f = _int_ctime64_s; - __MINGW_IMP_SYMBOL(_ctime64_s) = f; - } - return (*f)(d, dn, pt); -} - -errno_t __cdecl -_ctime64_s (char *d, size_t dn, const __time64_t *pt) -{ - return _stub (d, dn, pt); -} - -static errno_t __cdecl -_int_ctime64_s (char *d, size_t dn, const __time64_t *pt) -{ - struct tm ltm; - errno_t e; - - if (!d || !dn) - { - errno = EINVAL; - return EINVAL; - } - d[0] = 0; - if (!pt) - { - errno = EINVAL; - return EINVAL; - } - - if ((e = _localtime64_s (<m, pt)) != 0) - return e; - return asctime_s (d, dn, <m); -} diff --git a/lib/libc/mingw/secapi/_cwprintf_s.c b/lib/libc/mingw/secapi/_cwprintf_s.c deleted file mode 100644 index 013ccc472db1..000000000000 --- a/lib/libc/mingw/secapi/_cwprintf_s.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include -#include -#include -#include - -int __cdecl (*__MINGW_IMP_SYMBOL(_cwprintf_s))(const wchar_t *,...) = - _cwprintf_s; - -int __cdecl -_cwprintf_s (const wchar_t *s, ...) -{ - va_list argp; - int r; - - va_start (argp, s); - r = _vcwprintf_s (s, argp); - va_end (argp); - return r; -} diff --git a/lib/libc/mingw/secapi/_cwprintf_s_l.c b/lib/libc/mingw/secapi/_cwprintf_s_l.c deleted file mode 100644 index 50c9c4bad8d3..000000000000 --- a/lib/libc/mingw/secapi/_cwprintf_s_l.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include -#include -#include -#include - -int __cdecl (*__MINGW_IMP_SYMBOL(_cwprintf_s_l))(const wchar_t *, _locale_t, ...) = - _cwprintf_s_l; - -int __cdecl -_cwprintf_s_l (const wchar_t *s, _locale_t loc, ...) -{ - va_list argp; - int r; - - va_start (argp, loc); - r = _vcwprintf_s_l (s, loc, argp); - va_end (argp); - return r; -} diff --git a/lib/libc/mingw/secapi/_gmtime32_s.c b/lib/libc/mingw/secapi/_gmtime32_s.c deleted file mode 100644 index 7139c24df100..000000000000 --- a/lib/libc/mingw/secapi/_gmtime32_s.c +++ /dev/null @@ -1,51 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_gmtime32_s (struct tm *, const __time32_t *); -static errno_t __cdecl _stub (struct tm *, const __time32_t *); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(_gmtime32_s))(struct tm *, const __time32_t *) = - _stub; - -static errno_t __cdecl -_stub (struct tm *ptm, const __time32_t *pt) -{ - errno_t __cdecl (*f)(struct tm *, const __time32_t *) = __MINGW_IMP_SYMBOL(_gmtime32_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(struct tm *, const __time32_t *)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_gmtime32_s"); - if (!f) - f = _int_gmtime32_s; - __MINGW_IMP_SYMBOL(_gmtime32_s) = f; - } - return (*f)(ptm, pt); -} - -errno_t __cdecl -_gmtime32_s (struct tm *ptm, const __time32_t *pt) -{ - return _stub (ptm, pt); -} - -static errno_t __cdecl -_int_gmtime32_s (struct tm *ptm, const __time32_t *pt) -{ - struct tm *ltm; - - if (ptm) - memset (ptm, 0xff, sizeof (*ptm)); - if (!ptm || !pt) - { - errno = EINVAL; - return EINVAL; - } - if ((ltm = _gmtime32 (pt)) == NULL) - return errno; - *ptm = *ltm; - return 0; -} diff --git a/lib/libc/mingw/secapi/_gmtime64_s.c b/lib/libc/mingw/secapi/_gmtime64_s.c deleted file mode 100644 index c4ca154684b6..000000000000 --- a/lib/libc/mingw/secapi/_gmtime64_s.c +++ /dev/null @@ -1,51 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_gmtime64_s (struct tm *, const __time64_t *); -static errno_t __cdecl _stub (struct tm *, const __time64_t *); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(_gmtime64_s))(struct tm *, const __time64_t *) = - _stub; - -static errno_t __cdecl -_stub (struct tm *ptm, const __time64_t *pt) -{ - errno_t __cdecl (*f)(struct tm *, const __time64_t *) = __MINGW_IMP_SYMBOL(_gmtime64_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(struct tm *, const __time64_t *)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_gmtime64_s"); - if (!f) - f = _int_gmtime64_s; - __MINGW_IMP_SYMBOL(_gmtime64_s) = f; - } - return (*f)(ptm, pt); -} - -errno_t __cdecl -_gmtime64_s (struct tm *ptm, const __time64_t *pt) -{ - return _stub (ptm, pt); -} - -static errno_t __cdecl -_int_gmtime64_s (struct tm *ptm, const __time64_t *pt) -{ - struct tm *ltm; - - if (ptm) - memset (ptm, 0xff, sizeof (*ptm)); - if (!ptm || !pt) - { - errno = EINVAL; - return EINVAL; - } - if ((ltm = _gmtime64 (pt)) == NULL) - return errno; - *ptm = *ltm; - return 0; -} diff --git a/lib/libc/mingw/secapi/_localtime32_s.c b/lib/libc/mingw/secapi/_localtime32_s.c deleted file mode 100644 index c8a62f6ccee2..000000000000 --- a/lib/libc/mingw/secapi/_localtime32_s.c +++ /dev/null @@ -1,51 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_localtime32_s (struct tm *, const __time32_t *); -static errno_t __cdecl _stub (struct tm *, const __time32_t *); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(_localtime32_s))(struct tm *, const __time32_t *) = - _stub; - -static errno_t __cdecl -_stub (struct tm *ptm, const __time32_t *pt) -{ - errno_t __cdecl (*f)(struct tm *, const __time32_t *) = __MINGW_IMP_SYMBOL(_localtime32_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(struct tm *, const __time32_t *)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_localtime32_s"); - if (!f) - f = _int_localtime32_s; - __MINGW_IMP_SYMBOL(_localtime32_s) = f; - } - return (*f)(ptm, pt); -} - -errno_t __cdecl -_localtime32_s (struct tm *ptm, const __time32_t *pt) -{ - return _stub (ptm, pt); -} - -static errno_t __cdecl -_int_localtime32_s (struct tm *ptm, const __time32_t *pt) -{ - struct tm *ltm; - - if (ptm) - memset (ptm, 0xff, sizeof (*ptm)); - if (!ptm || !pt) - { - errno = EINVAL; - return EINVAL; - } - if ((ltm = _localtime32 (pt)) == NULL) - return errno; - *ptm = *ltm; - return 0; -} diff --git a/lib/libc/mingw/secapi/_localtime64_s.c b/lib/libc/mingw/secapi/_localtime64_s.c deleted file mode 100644 index bff0868ba1a4..000000000000 --- a/lib/libc/mingw/secapi/_localtime64_s.c +++ /dev/null @@ -1,51 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_localtime64_s (struct tm *, const __time64_t *); -static errno_t __cdecl _stub (struct tm *, const __time64_t *); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(_localtime64_s))(struct tm *, const __time64_t *) = - _stub; - -static errno_t __cdecl -_stub (struct tm *ptm, const __time64_t *pt) -{ - errno_t __cdecl (*f)(struct tm *, const __time64_t *) = __MINGW_IMP_SYMBOL(_localtime64_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(struct tm *, const __time64_t *)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_localtime64_s"); - if (!f) - f = _int_localtime64_s; - __MINGW_IMP_SYMBOL(_localtime64_s) = f; - } - return (*f)(ptm, pt); -} - -errno_t __cdecl -_localtime64_s (struct tm *ptm, const __time64_t *pt) -{ - return _stub (ptm, pt); -} - -static errno_t __cdecl -_int_localtime64_s (struct tm *ptm, const __time64_t *pt) -{ - struct tm *ltm; - - if (ptm) - memset (ptm, 0xff, sizeof (*ptm)); - if (!ptm || !pt) - { - errno = EINVAL; - return EINVAL; - } - if ((ltm = _localtime64 (pt)) == NULL) - return errno; - *ptm = *ltm; - return 0; -} diff --git a/lib/libc/mingw/secapi/_mktemp_s.c b/lib/libc/mingw/secapi/_mktemp_s.c deleted file mode 100644 index 01484d938457..000000000000 --- a/lib/libc/mingw/secapi/_mktemp_s.c +++ /dev/null @@ -1,54 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_mktemp_s (char *, size_t); -static errno_t __cdecl _stub (char *, size_t); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(_mktemp_s))(char *, size_t) = - _stub; - -static errno_t __cdecl -_stub (char *d, size_t dn) -{ - errno_t __cdecl (*f)(char *, size_t) = __MINGW_IMP_SYMBOL(_mktemp_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(char *, size_t)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_mktemp_s"); - if (!f) - f = _int_mktemp_s; - __MINGW_IMP_SYMBOL(_mktemp_s) = f; - } - return (*f)(d, dn); -} - -errno_t __cdecl -_mktemp_s (char *d, size_t dn) -{ - return _stub (d, dn); -} - -static errno_t __cdecl -_int_mktemp_s (char *d, size_t dn) -{ - size_t sz; - if (!d || !dn) - { - _mktemp (NULL); - return EINVAL; - } - sz = strnlen (d, dn); - if (sz >= dn || sz < 6) - { - d[0] = 0; - _mktemp (NULL); - return EINVAL; - } - if (_mktemp (d) != NULL) - return 0; - return errno; -} diff --git a/lib/libc/mingw/secapi/_sopen_s.c b/lib/libc/mingw/secapi/_sopen_s.c deleted file mode 100644 index b4f8f6af5b0c..000000000000 --- a/lib/libc/mingw/secapi/_sopen_s.c +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include -#include -#include - -static errno_t __cdecl _int_sopen_s(int *, const char *, int, int, int); -static errno_t __cdecl _stub(int *, const char *, int, int, int); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(_sopen_s))(int *, const char *, int, int, int) = _stub; - -static errno_t __cdecl -_stub (int* pfh, const char *filename, int oflag, int shflag, int pmode) -{ - errno_t __cdecl (*f)(int *, const char *, int, int, int) = __MINGW_IMP_SYMBOL(_sopen_s); - - if (f == _stub) { - f = (errno_t __cdecl (*)(int *, const char *, int, int, int)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_sopen_s"); - if (f == NULL) - f = _int_sopen_s; - __MINGW_IMP_SYMBOL(_sopen_s) = f; - } - - return (*f)(pfh, filename, oflag, shflag, pmode); -} - -static errno_t __cdecl _int_sopen_s(int* pfh, const char *filename, int oflag, int shflag, int pmode) -{ - if (pfh == NULL || filename == NULL) { - if (pfh != NULL) *pfh = -1; - errno = EINVAL; - return EINVAL; - } - - *pfh = _sopen(filename, oflag, shflag, pmode); - return errno; -} - -errno_t __cdecl _sopen_s(int* pfh, const char *filename, int oflag, int shflag, int pmode) -{ - return _stub (pfh, filename, oflag, shflag, pmode); -} diff --git a/lib/libc/mingw/secapi/_strdate_s.c b/lib/libc/mingw/secapi/_strdate_s.c deleted file mode 100644 index b62dec75216a..000000000000 --- a/lib/libc/mingw/secapi/_strdate_s.c +++ /dev/null @@ -1,68 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_strdate_s (char *, size_t); -static errno_t __cdecl _stub (char *, size_t); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(_strdate_s))(char *, size_t) = - _stub; - -static errno_t __cdecl -_stub (char *d, size_t dn) -{ - errno_t __cdecl (*f)(char *, size_t) = __MINGW_IMP_SYMBOL(_strdate_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(char *, size_t)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_strdate_s"); - if (!f) - f = _int_strdate_s; - __MINGW_IMP_SYMBOL(_strdate_s) = f; - } - return (*f)(d, dn); -} - -errno_t __cdecl -_strdate_s (char *d, size_t dn) -{ - return _stub (d, dn); -} - -static errno_t __cdecl -_int_strdate_s (char *d, size_t dn) -{ - SYSTEMTIME dt; - - if (!d || !dn) - { - errno = EINVAL; - return EINVAL; - } - - d[0] = 0; - - if (dn < 9) - { - errno = ERANGE; - return ERANGE; - } - - GetLocalTime (&dt); - dt.wYear %= 100; - - d[0] = (char) (dt.wMonth / 10 + '0'); - d[1] = (char) (dt.wMonth % 10 + '0'); - d[2] = '/'; - d[3] = (char) (dt.wDay / 10 + '0'); - d[4] = (char) (dt.wDay % 10 + '0'); - d[5] = '/'; - d[6] = (char) (dt.wYear / 10 + '0'); - d[7] = (char) (dt.wYear % 10 + '0'); - d[8] = 0; - - return 0; -} diff --git a/lib/libc/mingw/secapi/_strtime_s.c b/lib/libc/mingw/secapi/_strtime_s.c deleted file mode 100644 index b66e3f95a8d8..000000000000 --- a/lib/libc/mingw/secapi/_strtime_s.c +++ /dev/null @@ -1,72 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_strtime_s (char *, size_t); -static errno_t __cdecl _stub (char *, size_t); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(_strtime_s))(char *, size_t) = - _stub; - -static errno_t __cdecl -_stub (char *d, size_t dn) -{ - errno_t __cdecl (*f)(char *, size_t) = __MINGW_IMP_SYMBOL(_strtime_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(char *, size_t)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_strtime_s"); - if (!f) - f = _int_strtime_s; - __MINGW_IMP_SYMBOL(_strtime_s) = f; - } - return (*f)(d, dn); -} - -errno_t __cdecl -_strtime_s (char *d, size_t dn) -{ - return _stub (d, dn); -} - -static errno_t __cdecl -_int_strtime_s (char *d, size_t dn) -{ - SYSTEMTIME dt; - int hours, minutes, seconds; - - if (!d || !dn) - { - errno = EINVAL; - return EINVAL; - } - - d[0] = 0; - - if (dn < 9) - { - errno = ERANGE; - return ERANGE; - } - - GetLocalTime (&dt); - dt.wYear %= 100; - - hours = dt.wHour; - minutes = dt.wMinute; - seconds = dt.wSecond; - - d[2] = d[5] = ':'; - d[0] = (char) (hours / 10 + '0'); - d[1] = (char) (hours % 10 + '0'); - d[3] = (char) (minutes / 10 + '0'); - d[4] = (char) (minutes % 10 + '0'); - d[6] = (char) (seconds / 10 + '0'); - d[7] = (char) (seconds % 10 + '0'); - d[8] = 0; - - return 0; -} diff --git a/lib/libc/mingw/secapi/_umask_s.c b/lib/libc/mingw/secapi/_umask_s.c deleted file mode 100644 index 75e8ddbb4624..000000000000 --- a/lib/libc/mingw/secapi/_umask_s.c +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_umask_s (int, int *); -static errno_t __cdecl _stub (int, int *); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(_umask_s))(int, int *) = - _stub; - -static errno_t __cdecl -_stub (int m, int *pold) -{ - errno_t __cdecl (*f)(int, int *) = __MINGW_IMP_SYMBOL(_umask_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(int, int *)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_umask_s"); - if (!f) - f = _int_umask_s; - __MINGW_IMP_SYMBOL(_umask_s) = f; - } - return (*f)(m, pold); -} - -errno_t __cdecl -_umask_s (int m, int *pold) -{ - return _stub (m, pold); -} - -static errno_t __cdecl -_int_umask_s (int m, int *pold) -{ - if (!pold) - { - errno = EINVAL; - return EINVAL; - } - *pold = _umask (m); - return 0; -} diff --git a/lib/libc/mingw/secapi/_vcprintf_s.c b/lib/libc/mingw/secapi/_vcprintf_s.c deleted file mode 100644 index 91f143f1fa0f..000000000000 --- a/lib/libc/mingw/secapi/_vcprintf_s.c +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include -#include -#include -#include - -static int __cdecl _int_vcprintf_s (const char *, va_list); -static int __cdecl _stub (const char *, va_list); - -int __cdecl (*__MINGW_IMP_SYMBOL(_vcprintf_s))(const char *, va_list) = - _stub; - -static int __cdecl -_stub (const char *s, va_list argp) -{ - int __cdecl (*f)(const char *, va_list) = __MINGW_IMP_SYMBOL(_vcprintf_s); - - if (f == _stub) - { - f = (int __cdecl (*)(const char *, va_list)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_vcprintf_s"); - if (!f) - f = _int_vcprintf_s; - __MINGW_IMP_SYMBOL(_vcprintf_s) = f; - } - return (*f)(s, argp); -} - -int __cdecl -_vcprintf_s (const char *s, va_list argp) -{ - return _stub (s, argp); -} - -static int __cdecl -_int_vcprintf_s (const char *s, va_list argp) -{ - return _vcprintf (s, argp); -} diff --git a/lib/libc/mingw/secapi/_vcprintf_s_l.c b/lib/libc/mingw/secapi/_vcprintf_s_l.c deleted file mode 100644 index 787c76be4df0..000000000000 --- a/lib/libc/mingw/secapi/_vcprintf_s_l.c +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include -#include -#include -#include - -static int __cdecl _int_vcprintf_s_l (const char *, _locale_t, va_list); -static int __cdecl _stub (const char *, _locale_t, va_list); - -int __cdecl (*__MINGW_IMP_SYMBOL(_vcprintf_s_l))(const char *, _locale_t, va_list) = - _stub; - -static int __cdecl -_stub (const char *s, _locale_t loc, va_list argp) -{ - int __cdecl (*f)(const char *, _locale_t, va_list) = __MINGW_IMP_SYMBOL(_vcprintf_s_l); - - if (f == _stub) - { - f = (int __cdecl (*)(const char *, _locale_t, va_list)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_vcprintf_s_l"); - if (!f) - f = _int_vcprintf_s_l; - __MINGW_IMP_SYMBOL(_vcprintf_s_l) = f; - } - return (*f)(s, loc, argp); -} - -int __cdecl -_vcprintf_s_l (const char *s, _locale_t loc, va_list argp) -{ - return _stub (s, loc, argp); -} - -static int __cdecl -_int_vcprintf_s_l (const char *s, _locale_t loc, va_list argp) -{ - return _vcprintf_l (s, loc, argp); -} diff --git a/lib/libc/mingw/secapi/_vcwprintf_s.c b/lib/libc/mingw/secapi/_vcwprintf_s.c deleted file mode 100644 index 325e866197ab..000000000000 --- a/lib/libc/mingw/secapi/_vcwprintf_s.c +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include -#include -#include -#include - -static int __cdecl _int_vcwprintf_s (const wchar_t *, va_list); -static int __cdecl _stub (const wchar_t *, va_list); - -int __cdecl (*__MINGW_IMP_SYMBOL(_vcwprintf_s))(const wchar_t *, va_list) = - _stub; - -static int __cdecl -_stub (const wchar_t *s, va_list argp) -{ - int __cdecl (*f)(const wchar_t *, va_list) = __MINGW_IMP_SYMBOL(_vcwprintf_s); - - if (f == _stub) - { - f = (int __cdecl (*)(const wchar_t *, va_list)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_vcwprintf_s"); - if (!f) - f = _int_vcwprintf_s; - __MINGW_IMP_SYMBOL(_vcwprintf_s) = f; - } - return (*f)(s, argp); -} - -int __cdecl -_vcwprintf_s (const wchar_t *s, va_list argp) -{ - return _stub (s, argp); -} - -static int __cdecl -_int_vcwprintf_s (const wchar_t *s, va_list argp) -{ - return _vcwprintf (s, argp); -} diff --git a/lib/libc/mingw/secapi/_vcwprintf_s_l.c b/lib/libc/mingw/secapi/_vcwprintf_s_l.c deleted file mode 100644 index 4d112a1c52ef..000000000000 --- a/lib/libc/mingw/secapi/_vcwprintf_s_l.c +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include -#include -#include -#include - -static int __cdecl _int_vcwprintf_s_l (const wchar_t *, _locale_t, va_list); -static int __cdecl _stub (const wchar_t *, _locale_t, va_list); - -int __cdecl (*__MINGW_IMP_SYMBOL(_vcwprintf_s_l))(const wchar_t *, _locale_t, va_list) = - _stub; - -static int __cdecl -_stub (const wchar_t *s, _locale_t loc, va_list argp) -{ - int __cdecl (*f)(const wchar_t *, _locale_t, va_list) = __MINGW_IMP_SYMBOL(_vcwprintf_s_l); - - if (f == _stub) - { - f = (int __cdecl (*)(const wchar_t *, _locale_t, va_list)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_vcwprintf_s_l"); - if (!f) - f = _int_vcwprintf_s_l; - __MINGW_IMP_SYMBOL(_vcwprintf_s_l) = f; - } - return (*f)(s, loc, argp); -} - -int __cdecl -_vcwprintf_s_l (const wchar_t *s, _locale_t loc, va_list argp) -{ - return _stub (s, loc, argp); -} - -static int __cdecl -_int_vcwprintf_s_l (const wchar_t *s, _locale_t loc, va_list argp) -{ - return _vcwprintf_l (s, loc, argp); -} diff --git a/lib/libc/mingw/secapi/_vscprintf_p.c b/lib/libc/mingw/secapi/_vscprintf_p.c deleted file mode 100644 index 3761c21b49be..000000000000 --- a/lib/libc/mingw/secapi/_vscprintf_p.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int __cdecl _vscprintf_p(const char *format, va_list arglist) -{ - return _vscprintf_p_l(format, NULL, arglist); -} - -int __cdecl (*__MINGW_IMP_SYMBOL(_vscprintf_p))(const char *, va_list) = _vscprintf_p; diff --git a/lib/libc/mingw/secapi/_vscwprintf_p.c b/lib/libc/mingw/secapi/_vscwprintf_p.c deleted file mode 100644 index 666286a62f0e..000000000000 --- a/lib/libc/mingw/secapi/_vscwprintf_p.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int __cdecl _vscwprintf_p(const wchar_t *format, va_list arglist) -{ - return _vscwprintf_p_l(format, NULL, arglist); -} - -int __cdecl (*__MINGW_IMP_SYMBOL(_vscwprintf_p))(const wchar_t *, va_list) = _vscwprintf_p; diff --git a/lib/libc/mingw/secapi/_vswprintf_p.c b/lib/libc/mingw/secapi/_vswprintf_p.c deleted file mode 100644 index 52e9dfa59e80..000000000000 --- a/lib/libc/mingw/secapi/_vswprintf_p.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int __cdecl _vswprintf_p(wchar_t *_DstBuf, size_t _MaxCount, const wchar_t *_Format, va_list _ArgList) -{ - return _vswprintf_p_l(_DstBuf, _MaxCount, _Format, NULL, _ArgList); -} - -int __cdecl (*__MINGW_IMP_SYMBOL(_vswprintf_p))(wchar_t*,size_t,const wchar_t*,va_list) = _vswprintf_p; diff --git a/lib/libc/mingw/secapi/_waccess_s.c b/lib/libc/mingw/secapi/_waccess_s.c deleted file mode 100644 index c4825cff4489..000000000000 --- a/lib/libc/mingw/secapi/_waccess_s.c +++ /dev/null @@ -1,46 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_waccess_s (const wchar_t *, int); -static errno_t __cdecl _stub (const wchar_t *, int); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(_waccess_s))(const wchar_t *, int) = - _stub; - -static errno_t __cdecl -_stub (const wchar_t *s, int m) -{ - errno_t __cdecl (*f)(const wchar_t *, int) = __MINGW_IMP_SYMBOL(_waccess_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(const wchar_t *, int)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_waccess_s"); - if (!f) - f = _int_waccess_s; - __MINGW_IMP_SYMBOL(_waccess_s) = f; - } - return (*f)(s, m); -} - -errno_t __cdecl -_waccess_s (const wchar_t *s, int m) -{ - return _stub (s, m); -} - -static errno_t __cdecl -_int_waccess_s (const wchar_t *s, int m) -{ - if (!s || (m & ~6) != 0) - { - _waccess (NULL, m); - return EINVAL; - } - if (!_waccess (s, m)) - return 0; - return errno; -} diff --git a/lib/libc/mingw/secapi/_wasctime_s.c b/lib/libc/mingw/secapi/_wasctime_s.c deleted file mode 100644 index 6b414ee9dd25..000000000000 --- a/lib/libc/mingw/secapi/_wasctime_s.c +++ /dev/null @@ -1,52 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_wasctime_s (wchar_t *, size_t, const struct tm *); -static errno_t __cdecl _stub (wchar_t *, size_t, const struct tm *); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(_wasctime_s))(wchar_t *, size_t, const struct tm *) = - _stub; - -static errno_t __cdecl -_stub (wchar_t *d, size_t dn, const struct tm *pt) -{ - errno_t __cdecl (*f)(wchar_t *, size_t, const struct tm *) = __MINGW_IMP_SYMBOL(_wasctime_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(wchar_t *, size_t, const struct tm *)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_wasctime_s"); - if (!f) - f = _int_wasctime_s; - __MINGW_IMP_SYMBOL(_wasctime_s) = f; - } - return (*f)(d, dn, pt); -} - -errno_t __cdecl -_wasctime_s (wchar_t *d, size_t dn, const struct tm *pt) -{ - return _stub (d, dn, pt); -} - -static errno_t __cdecl -_int_wasctime_s (wchar_t *d, size_t dn, const struct tm *pt) -{ - wchar_t *tmp; - size_t i; - - if (d && dn) - d[0] = 0; - if (!d || dn < 26 || !pt || (tmp = _wasctime (pt)) == NULL) - { - errno = EINVAL; - return EINVAL; - } - for (i = 0; tmp[i] != 0; i++) - d[i] = tmp[i]; - d[i] = 0; - return 0; -} diff --git a/lib/libc/mingw/secapi/_wctime32_s.c b/lib/libc/mingw/secapi/_wctime32_s.c deleted file mode 100644 index 27c414b161ed..000000000000 --- a/lib/libc/mingw/secapi/_wctime32_s.c +++ /dev/null @@ -1,56 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_wctime32_s (wchar_t *, size_t, const __time32_t *); -static errno_t __cdecl _stub (wchar_t *, size_t, const __time32_t *); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(_wctime32_s))(wchar_t *, size_t, const __time32_t *) = - _stub; - -static errno_t __cdecl -_stub (wchar_t *d, size_t dn, const __time32_t *pt) -{ - errno_t __cdecl (*f)(wchar_t*,size_t, const __time32_t *) = __MINGW_IMP_SYMBOL(_wctime32_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(wchar_t *, size_t, const __time32_t *)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_wctime32_s"); - if (!f) - f = _int_wctime32_s; - __MINGW_IMP_SYMBOL(_wctime32_s) = f; - } - return (*f)(d, dn, pt); -} - -errno_t __cdecl -_wctime32_s (wchar_t *d, size_t dn, const __time32_t *pt) -{ - return _stub (d, dn, pt); -} - -static errno_t __cdecl -_int_wctime32_s (wchar_t *d, size_t dn, const __time32_t *pt) -{ - struct tm ltm; - errno_t e; - - if (!d || !dn) - { - errno = EINVAL; - return EINVAL; - } - d[0] = 0; - if (!pt) - { - errno = EINVAL; - return EINVAL; - } - - if ((e = _localtime32_s (<m, pt)) != 0) - return e; - return _wasctime_s (d, dn, <m); -} diff --git a/lib/libc/mingw/secapi/_wctime64_s.c b/lib/libc/mingw/secapi/_wctime64_s.c deleted file mode 100644 index bce40fd227f9..000000000000 --- a/lib/libc/mingw/secapi/_wctime64_s.c +++ /dev/null @@ -1,56 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_wctime64_s (wchar_t *, size_t, const __time64_t *); -static errno_t __cdecl _stub (wchar_t *, size_t, const __time64_t *); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(_wctime64_s))(wchar_t *, size_t, const __time64_t *) = - _stub; - -static errno_t __cdecl -_stub (wchar_t *d, size_t dn, const __time64_t *pt) -{ - errno_t __cdecl (*f)(wchar_t*,size_t, const __time64_t *) = __MINGW_IMP_SYMBOL(_wctime64_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(wchar_t *, size_t, const __time64_t *)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_wctime64_s"); - if (!f) - f = _int_wctime64_s; - __MINGW_IMP_SYMBOL(_wctime64_s) = f; - } - return (*f)(d, dn, pt); -} - -errno_t __cdecl -_wctime64_s (wchar_t *d, size_t dn, const __time64_t *pt) -{ - return _stub (d, dn, pt); -} - -static errno_t __cdecl -_int_wctime64_s (wchar_t *d, size_t dn, const __time64_t *pt) -{ - struct tm ltm; - errno_t e; - - if (!d || !dn) - { - errno = EINVAL; - return EINVAL; - } - d[0] = 0; - if (!pt) - { - errno = EINVAL; - return EINVAL; - } - - if ((e = _localtime64_s (<m, pt)) != 0) - return e; - return _wasctime_s (d, dn, <m); -} diff --git a/lib/libc/mingw/secapi/_wmktemp_s.c b/lib/libc/mingw/secapi/_wmktemp_s.c deleted file mode 100644 index e13abc790828..000000000000 --- a/lib/libc/mingw/secapi/_wmktemp_s.c +++ /dev/null @@ -1,54 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_wmktemp_s (wchar_t *, size_t); -static errno_t __cdecl _stub (wchar_t *, size_t); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(_wmktemp_s))(wchar_t *, size_t) = - _stub; - -static errno_t __cdecl -_stub (wchar_t *d, size_t dn) -{ - errno_t __cdecl (*f)(wchar_t *, size_t) = __MINGW_IMP_SYMBOL(_wmktemp_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(wchar_t *, size_t)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_wmktemp_s"); - if (!f) - f = _int_wmktemp_s; - __MINGW_IMP_SYMBOL(_wmktemp_s) = f; - } - return (*f)(d, dn); -} - -errno_t __cdecl -_wmktemp_s (wchar_t *d, size_t dn) -{ - return _stub (d, dn); -} - -static errno_t __cdecl -_int_wmktemp_s (wchar_t *d, size_t dn) -{ - size_t sz; - if (!d || !dn) - { - _wmktemp (NULL); - return EINVAL; - } - sz = wcsnlen (d, dn); - if (sz >= dn || sz < 6) - { - d[0] = 0; - _wmktemp (NULL); - return EINVAL; - } - if (_wmktemp (d) != NULL) - return 0; - return errno; -} diff --git a/lib/libc/mingw/secapi/_wstrdate_s.c b/lib/libc/mingw/secapi/_wstrdate_s.c deleted file mode 100644 index e8ec1d446e6c..000000000000 --- a/lib/libc/mingw/secapi/_wstrdate_s.c +++ /dev/null @@ -1,68 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_wstrdate_s (wchar_t *, size_t); -static errno_t __cdecl _stub (wchar_t *, size_t); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(_wstrdate_s))(wchar_t *, size_t) = - _stub; - -static errno_t __cdecl -_stub (wchar_t *d, size_t dn) -{ - errno_t __cdecl (*f)(wchar_t *, size_t) = __MINGW_IMP_SYMBOL(_wstrdate_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(wchar_t *, size_t)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_wstrdate_s"); - if (!f) - f = _int_wstrdate_s; - __MINGW_IMP_SYMBOL(_wstrdate_s) = f; - } - return (*f)(d, dn); -} - -errno_t __cdecl -_wstrdate_s (wchar_t *d, size_t dn) -{ - return _stub (d, dn); -} - -static errno_t __cdecl -_int_wstrdate_s (wchar_t *d, size_t dn) -{ - SYSTEMTIME dt; - - if (!d || !dn) - { - errno = EINVAL; - return EINVAL; - } - - d[0] = 0; - - if (dn < 9) - { - errno = ERANGE; - return ERANGE; - } - - GetLocalTime (&dt); - dt.wYear %= 100; - - d[0] = (wchar_t) (dt.wMonth / 10 + '0'); - d[1] = (wchar_t) (dt.wMonth % 10 + '0'); - d[2] = '/'; - d[3] = (wchar_t) (dt.wDay / 10 + '0'); - d[4] = (wchar_t) (dt.wDay % 10 + '0'); - d[5] = '/'; - d[6] = (wchar_t) (dt.wYear / 10 + '0'); - d[7] = (wchar_t) (dt.wYear % 10 + '0'); - d[8] = 0; - - return 0; -} diff --git a/lib/libc/mingw/secapi/_wstrtime_s.c b/lib/libc/mingw/secapi/_wstrtime_s.c deleted file mode 100644 index ffb8a3e96ff1..000000000000 --- a/lib/libc/mingw/secapi/_wstrtime_s.c +++ /dev/null @@ -1,71 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_wstrtime_s (wchar_t *, size_t); -static errno_t __cdecl _stub (wchar_t *, size_t); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(_wstrtime_s))(wchar_t *, size_t) = - _stub; - -static errno_t __cdecl -_stub (wchar_t *d, size_t dn) -{ - errno_t __cdecl (*f)(wchar_t *, size_t) = __MINGW_IMP_SYMBOL(_wstrtime_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(wchar_t *, size_t)) - GetProcAddress (__mingw_get_msvcrt_handle (), "_wstrtime_s"); - if (!f) - f = _int_wstrtime_s; - __MINGW_IMP_SYMBOL(_wstrtime_s) = f; - } - return (*f)(d, dn); -} - -errno_t __cdecl -_wstrtime_s (wchar_t *d, size_t dn) -{ - return _stub (d, dn); -} - -static errno_t __cdecl -_int_wstrtime_s (wchar_t *d, size_t dn) -{ - SYSTEMTIME dt; - int hours, minutes, seconds; - - if (!d || !dn) - { - errno = EINVAL; - return EINVAL; - } - - d[0] = 0; - - if (dn < 9) - { - errno = ERANGE; - return ERANGE; - } - - GetLocalTime (&dt); - - hours = dt.wHour; - minutes = dt.wMinute; - seconds = dt.wSecond; - - d[2] = d[5] = ':'; - d[0] = (wchar_t) (hours / 10 + '0'); - d[1] = (wchar_t) (hours % 10 + '0'); - d[3] = (wchar_t) (minutes / 10 + '0'); - d[4] = (wchar_t) (minutes % 10 + '0'); - d[6] = (wchar_t) (seconds / 10 + '0'); - d[7] = (wchar_t) (seconds % 10 + '0'); - d[8] = 0; - - return 0; -} diff --git a/lib/libc/mingw/secapi/asctime_s.c b/lib/libc/mingw/secapi/asctime_s.c deleted file mode 100644 index aeb16e3bcffb..000000000000 --- a/lib/libc/mingw/secapi/asctime_s.c +++ /dev/null @@ -1,52 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_asctime_s (char *, size_t, const struct tm *); -static errno_t __cdecl _stub (char *, size_t, const struct tm *); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(asctime_s))(char *, size_t, const struct tm *) = - _stub; - -static errno_t __cdecl -_stub (char *d, size_t dn, const struct tm *pt) -{ - errno_t __cdecl (*f)(char *, size_t, const struct tm *) = __MINGW_IMP_SYMBOL(asctime_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(char *, size_t, const struct tm *)) - GetProcAddress (__mingw_get_msvcrt_handle (), "asctime_s"); - if (!f) - f = _int_asctime_s; - __MINGW_IMP_SYMBOL(asctime_s) = f; - } - return (*f)(d, dn, pt); -} - -errno_t __cdecl -asctime_s (char *d, size_t dn, const struct tm *pt) -{ - return _stub (d, dn, pt); -} - -static errno_t __cdecl -_int_asctime_s (char *d, size_t dn, const struct tm *pt) -{ - char *tmp; - size_t i; - - if (d && dn) - d[0] = 0; - if (!d || dn < 26 || !pt || (tmp = asctime (pt)) == NULL) - { - errno = EINVAL; - return EINVAL; - } - for (i = 0; tmp[i] != 0; i++) - d[i] = tmp[i]; - d[i] = 0; - return 0; -} diff --git a/lib/libc/mingw/secapi/memcpy_s.c b/lib/libc/mingw/secapi/memcpy_s.c deleted file mode 100644 index 013eff05c5cf..000000000000 --- a/lib/libc/mingw/secapi/memcpy_s.c +++ /dev/null @@ -1,59 +0,0 @@ -#include -#include -#include -#include - -static errno_t __cdecl _int_memcpy_s (void *, size_t, const void *, size_t); -static errno_t __cdecl _stub (void *, size_t, const void *, size_t); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(memcpy_s))(void *, size_t, const void *, size_t) = - _stub; - -static errno_t __cdecl -_stub (void *d, size_t dn, const void *s, size_t n) -{ - errno_t __cdecl (*f)(void *, size_t, const void *, size_t) = __MINGW_IMP_SYMBOL(memcpy_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(void *, size_t, const void *, size_t)) - GetProcAddress (__mingw_get_msvcrt_handle (), "memcpy_s"); - if (!f) - f = _int_memcpy_s; - __MINGW_IMP_SYMBOL(memcpy_s) = f; - } - return (*f)(d, dn, s, n); -} - -errno_t __cdecl -memcpy_s (void *d, size_t dn, const void *s, size_t n) -{ - return _stub (d, dn, s, n); -} - -static errno_t __cdecl -_int_memcpy_s (void *d, size_t dn, const void *s, size_t n) -{ - if (!n) - return 0; - - if (!d || !s) - { - if (d) - memset (d, 0, dn); - errno = EINVAL; - return EINVAL; - } - - if (dn < n) - { - memset (d, 0, dn); - - errno = ERANGE; - return ERANGE; - } - - memcpy (d, s, n); - - return 0; -} diff --git a/lib/libc/mingw/secapi/memmove_s.c b/lib/libc/mingw/secapi/memmove_s.c deleted file mode 100644 index dca1dbe57ea1..000000000000 --- a/lib/libc/mingw/secapi/memmove_s.c +++ /dev/null @@ -1,59 +0,0 @@ -#include -#include -#include -#include - -static errno_t __cdecl _int_memmove_s (void *, size_t, const void *, size_t); -static errno_t __cdecl _stub (void *, size_t, const void *, size_t); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(memmove_s))(void *, size_t, const void *, size_t) = - _stub; - -static errno_t __cdecl -_stub (void *d, size_t dn, const void *s, size_t n) -{ - errno_t __cdecl (*f)(void *, size_t, const void *, size_t) = __MINGW_IMP_SYMBOL(memmove_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(void *, size_t, const void *, size_t)) - GetProcAddress (__mingw_get_msvcrt_handle (), "memmove_s"); - if (!f) - f = _int_memmove_s; - __MINGW_IMP_SYMBOL(memmove_s) = f; - } - return (*f)(d, dn, s, n); -} - -errno_t __cdecl -memmove_s (void *d, size_t dn, const void *s, size_t n) -{ - return _stub (d, dn, s, n); -} - -static errno_t __cdecl -_int_memmove_s (void *d, size_t dn, const void *s, size_t n) -{ - if (!n) - return 0; - - if (!d || !s) - { - if (d) - memset (d, 0, dn); - errno = EINVAL; - return EINVAL; - } - - if (dn < n) - { - memset (d, 0, dn); - - errno = ERANGE; - return ERANGE; - } - - memmove (d, s, n); - - return 0; -} diff --git a/lib/libc/mingw/secapi/rand_s.c b/lib/libc/mingw/secapi/rand_s.c deleted file mode 100644 index 52700ba4fa5f..000000000000 --- a/lib/libc/mingw/secapi/rand_s.c +++ /dev/null @@ -1,36 +0,0 @@ -#define _CRT_RAND_S -#include -#include -#include -#include -#include - -static BOOLEAN (WINAPI *pRtlGenRandom)(void*,ULONG); - -static errno_t mingw_rand_s(unsigned int *pval) -{ - return !pval || !pRtlGenRandom || !pRtlGenRandom(pval, sizeof(*pval)) ? EINVAL : 0; -} - -static errno_t __cdecl init_rand_s(unsigned int*); - -errno_t (__cdecl *__MINGW_IMP_SYMBOL(rand_s))(unsigned int*) = init_rand_s; - -errno_t __cdecl -rand_s(unsigned int *val) -{ - return __MINGW_IMP_SYMBOL(rand_s)(val); -} - -static errno_t __cdecl init_rand_s(unsigned int *val) -{ - int (__cdecl *func)(unsigned int*); - - func = (void*)GetProcAddress(__mingw_get_msvcrt_handle(), "rand_s"); - if(!func) { - func = mingw_rand_s; - pRtlGenRandom = (void*)GetProcAddress(LoadLibraryW(L"advapi32.dll"), "SystemFunction036"); - } - - return (__MINGW_IMP_SYMBOL(rand_s) = func)(val); -} diff --git a/lib/libc/mingw/secapi/sprintf_s.c b/lib/libc/mingw/secapi/sprintf_s.c deleted file mode 100644 index eab682a2dcfa..000000000000 --- a/lib/libc/mingw/secapi/sprintf_s.c +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include -#include -#include -#include - -int __cdecl (*__MINGW_IMP_SYMBOL(sprintf_s))(char *, size_t, const char *,...) = sprintf_s; - -int __cdecl -sprintf_s (char *_DstBuf, size_t _Size, const char *_Format, ...) -{ - va_list argp; - int r; - - va_start (argp, _Format); - r = vsprintf_s (_DstBuf, _Size, _Format, argp); - va_end (argp); - return r; -} diff --git a/lib/libc/mingw/secapi/strerror_s.c b/lib/libc/mingw/secapi/strerror_s.c deleted file mode 100644 index 1216c4131c1c..000000000000 --- a/lib/libc/mingw/secapi/strerror_s.c +++ /dev/null @@ -1,54 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_strerror_s (char *, size_t, int); -static errno_t __cdecl _stub (char *, size_t, int); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(strerror_s))(char *, size_t, int) = _stub; - -static errno_t __cdecl -_stub (char *buffer, size_t numberOfElements, int errnum) -{ - errno_t __cdecl (*f)(char *, size_t, int) = __MINGW_IMP_SYMBOL(strerror_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(char *, size_t, int)) - GetProcAddress (__mingw_get_msvcrt_handle (), "strerror_s"); - if (!f) - { - f = _int_strerror_s; - } - __MINGW_IMP_SYMBOL(strerror_s) = f; - } - return (*f)(buffer, numberOfElements, errnum); -} - -errno_t __cdecl -strerror_s (char *buffer, size_t numberOfElements, int errnum) -{ - return _stub (buffer, numberOfElements, errnum); -} - -static errno_t __cdecl -_int_strerror_s (char *buffer, size_t numberOfElements, int errnum) -{ - char *errmsg = strerror(errnum); - - if (!errmsg || !buffer || numberOfElements == 0) - { - errno = EINVAL; - return EINVAL; - } - - if (sprintf_s(buffer, numberOfElements, "%s", errmsg) == -1) - { - errno = EINVAL; - return EINVAL; - } - - return 0; -} diff --git a/lib/libc/mingw/secapi/vsprintf_s.c b/lib/libc/mingw/secapi/vsprintf_s.c deleted file mode 100644 index 45dfb14b1106..000000000000 --- a/lib/libc/mingw/secapi/vsprintf_s.c +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include -#include -#include -#include -#include - -static int __cdecl _int_vsprintf_s (char *, size_t, const char *, va_list); -static int __cdecl _stub (char *, size_t, const char *, va_list); - -int __cdecl (*__MINGW_IMP_SYMBOL(vsprintf_s))(char *, size_t, const char *, va_list) = - _stub; - -static int __cdecl -_stub (char *_DstBuf, size_t _Size, const char *_Format, va_list _ArgList) -{ - int __cdecl (*f)(char *, size_t, const char *, va_list) = __MINGW_IMP_SYMBOL(vsprintf_s); - - if (f == _stub) - { - f = (int __cdecl (*)(char *, size_t, const char *, va_list)) - GetProcAddress (__mingw_get_msvcrt_handle (), "vsprintf_s"); - if (!f) - f = _int_vsprintf_s; - __MINGW_IMP_SYMBOL(vsprintf_s) = f; - } - return (*f)(_DstBuf, _Size, _Format, _ArgList); -} - -int __cdecl -vsprintf_s (char *_DstBuf, size_t _Size, const char *_Format, va_list _ArgList) -{ - return _stub (_DstBuf, _Size, _Format, _ArgList); -} - -static int __cdecl -_int_vsprintf_s (char *_DstBuf, size_t _Size, const char *_Format, va_list _ArgList) -{ - return __ms_vsnprintf (_DstBuf, _Size, _Format, _ArgList); -} diff --git a/lib/libc/mingw/secapi/wmemcpy_s.c b/lib/libc/mingw/secapi/wmemcpy_s.c deleted file mode 100644 index 83879246ed4d..000000000000 --- a/lib/libc/mingw/secapi/wmemcpy_s.c +++ /dev/null @@ -1,60 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_wmemcpy_s (wchar_t *, size_t, const wchar_t *, size_t); -static errno_t __cdecl _stub (wchar_t *, size_t, const wchar_t *, size_t); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(wmemcpy_s))(wchar_t *, size_t, const wchar_t *, size_t) = - _stub; - -static errno_t __cdecl -_stub (wchar_t *d, size_t dn, const wchar_t *s, size_t n) -{ - errno_t __cdecl (*f)(wchar_t *, size_t, const wchar_t *, size_t) = __MINGW_IMP_SYMBOL(wmemcpy_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(wchar_t *, size_t, const wchar_t *, size_t)) - GetProcAddress (__mingw_get_msvcrt_handle (), "wmemcpy_s"); - if (!f) - f = _int_wmemcpy_s; - __MINGW_IMP_SYMBOL(wmemcpy_s) = f; - } - return (*f)(d, dn, s, n); -} - -errno_t __cdecl -wmemcpy_s (wchar_t *d, size_t dn, const wchar_t *s, size_t n) -{ - return _stub (d, dn, s, n); -} - -static errno_t __cdecl -_int_wmemcpy_s (wchar_t *d, size_t dn, const wchar_t *s, size_t n) -{ - if (!n) - return 0; - - if (!d || !s) - { - if (d) - memset (d, 0, dn * sizeof (wchar_t)); - errno = EINVAL; - return EINVAL; - } - - if (dn < n) - { - memset (d, 0, dn * sizeof (wchar_t)); - - errno = ERANGE; - return ERANGE; - } - - memcpy (d, s, n * sizeof (wchar_t)); - - return 0; -} diff --git a/lib/libc/mingw/secapi/wmemmove_s.c b/lib/libc/mingw/secapi/wmemmove_s.c deleted file mode 100644 index 2e0d572efdf3..000000000000 --- a/lib/libc/mingw/secapi/wmemmove_s.c +++ /dev/null @@ -1,60 +0,0 @@ -#include -#include -#include -#include -#include - -static errno_t __cdecl _int_wmemmove_s (wchar_t *, size_t, const wchar_t*, size_t); -static errno_t __cdecl _stub (wchar_t *, size_t, const wchar_t *, size_t); - -errno_t __cdecl (*__MINGW_IMP_SYMBOL(wmemmove_s))(wchar_t *, size_t, const wchar_t *, size_t) = - _stub; - -static errno_t __cdecl -_stub (wchar_t *d, size_t dn, const wchar_t *s, size_t n) -{ - errno_t __cdecl (*f)(wchar_t *, size_t, const wchar_t *, size_t) = __MINGW_IMP_SYMBOL(wmemmove_s); - - if (f == _stub) - { - f = (errno_t __cdecl (*)(wchar_t *, size_t, const wchar_t *, size_t)) - GetProcAddress (__mingw_get_msvcrt_handle (), "wmemmove_s"); - if (!f) - f = _int_wmemmove_s; - __MINGW_IMP_SYMBOL(wmemmove_s) = f; - } - return (*f)(d, dn, s, n); -} - -errno_t __cdecl -wmemmove_s (wchar_t *d, size_t dn, const wchar_t *s, size_t n) -{ - return _stub (d, dn, s, n); -} - -static errno_t __cdecl -_int_wmemmove_s (wchar_t *d, size_t dn, const wchar_t *s, size_t n) -{ - if (!n) - return 0; - - if (!d || !s) - { - if (d) - memset (d, 0, dn * sizeof (wchar_t)); - errno = EINVAL; - return EINVAL; - } - - if (dn < n) - { - memset (d, 0, dn * sizeof (wchar_t)); - - errno = ERANGE; - return ERANGE; - } - - memmove (d, s, n * sizeof (wchar_t)); - - return 0; -} diff --git a/lib/libc/mingw/stdio/_getc_nolock.c b/lib/libc/mingw/stdio/_getc_nolock.c deleted file mode 100644 index 8b34d98cb4e3..000000000000 --- a/lib/libc/mingw/stdio/_getc_nolock.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -#undef _getc_nolock -int __cdecl _getc_nolock(FILE *stream); -int __cdecl _getc_nolock(FILE *stream) -{ - return _fgetc_nolock(stream); -} diff --git a/lib/libc/mingw/stdio/_getwc_nolock.c b/lib/libc/mingw/stdio/_getwc_nolock.c deleted file mode 100644 index fba41ca5adab..000000000000 --- a/lib/libc/mingw/stdio/_getwc_nolock.c +++ /dev/null @@ -1,10 +0,0 @@ -#undef __MSVCRT_VERSION__ -#define __MSVCRT_VERSION__ 0x800 -#include - -#undef _getwc_nolock -wint_t __cdecl _getwc_nolock(FILE *stream); -wint_t __cdecl _getwc_nolock(FILE *stream) -{ - return _fgetwc_nolock(stream); -} diff --git a/lib/libc/mingw/stdio/_putc_nolock.c b/lib/libc/mingw/stdio/_putc_nolock.c deleted file mode 100644 index 47f1655bd01b..000000000000 --- a/lib/libc/mingw/stdio/_putc_nolock.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -#undef _putc_nolock -int __cdecl _putc_nolock(int c, FILE *stream); -int __cdecl _putc_nolock(int c, FILE *stream) -{ - return _fputc_nolock(c, stream); -} diff --git a/lib/libc/mingw/stdio/_putwc_nolock.c b/lib/libc/mingw/stdio/_putwc_nolock.c deleted file mode 100644 index 44da19f4cf4d..000000000000 --- a/lib/libc/mingw/stdio/_putwc_nolock.c +++ /dev/null @@ -1,10 +0,0 @@ -#undef __MSVCRT_VERSION__ -#define __MSVCRT_VERSION__ 0x800 -#include - -#undef _putwc_nolock -wint_t __cdecl _putwc_nolock(wchar_t c, FILE *stream); -wint_t __cdecl _putwc_nolock(wchar_t c, FILE *stream) -{ - return _fputwc_nolock(c, stream); -} diff --git a/lib/libc/mingw/stdio/_vscprintf.c b/lib/libc/mingw/stdio/_vscprintf.c deleted file mode 100644 index bb596b4d67dc..000000000000 --- a/lib/libc/mingw/stdio/_vscprintf.c +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -#include -#include -#include -#include -#include - -/* emulation of _vscprintf() via _vsnprintf() */ -static int __cdecl emu_vscprintf(const char * __restrict__ format, va_list arglist) -{ - char *buffer, *new_buffer; - size_t size; - int ret = -1; - - /* if format is a null pointer, _vscprintf() returns -1 and sets errno to EINVAL */ - if (!format) { - _set_errno(EINVAL); - return -1; - } - - /* size for _vsnprintf() must be non-zero and buffer must have place for terminating null character */ - size = strlen(format) * 2 + 1; - buffer = malloc(size); - - if (!buffer) { - _set_errno(ENOMEM); - return -1; - } - - /* if the number of characters to write is greater than size, _vsnprintf() returns -1 */ - while (size < SIZE_MAX/2 && (ret = _vsnprintf(buffer, size, format, arglist)) < 0) { - /* in this case try with larger buffer */ - size *= 2; - new_buffer = realloc(buffer, size); - if (!new_buffer) - break; - buffer = new_buffer; - } - - free(buffer); - - if (ret < 0) { - _set_errno(ENOMEM); - return -1; - } - - return ret; -} - -#ifndef __LIBMSVCRT_OS__ - -int (__cdecl *__MINGW_IMP_SYMBOL(_vscprintf))(const char * __restrict__, va_list) = emu_vscprintf; - -#else - -#include - -static int __cdecl init_vscprintf(const char * __restrict__ format, va_list arglist); - -int (__cdecl *__MINGW_IMP_SYMBOL(_vscprintf))(const char * __restrict__, va_list) = init_vscprintf; - -static int __cdecl init_vscprintf(const char * __restrict__ format, va_list arglist) -{ - HMODULE msvcrt = __mingw_get_msvcrt_handle(); - int (__cdecl *func)(const char * __restrict__, va_list) = NULL; - - if (msvcrt) - func = (int (__cdecl *)(const char * __restrict__, va_list))GetProcAddress(msvcrt, "_vscprintf"); - - if (!func) - func = emu_vscprintf; - - return (__MINGW_IMP_SYMBOL(_vscprintf) = func)(format, arglist); -} - -#endif - -int __cdecl _vscprintf(const char * __restrict__ format, va_list arglist) -{ - return __MINGW_IMP_SYMBOL(_vscprintf)(format, arglist); -} diff --git a/lib/libc/mingw/stdio/acrt_iob_func.c b/lib/libc/mingw/stdio/acrt_iob_func.c deleted file mode 100644 index 085a5fa739ee..000000000000 --- a/lib/libc/mingw/stdio/acrt_iob_func.c +++ /dev/null @@ -1,15 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -FILE *__cdecl __acrt_iob_func(unsigned index) -{ - return &(__iob_func()[index]); -} - -typedef FILE *__cdecl (*_f__acrt_iob_func)(unsigned index); -_f__acrt_iob_func __MINGW_IMP_SYMBOL(__acrt_iob_func) = __acrt_iob_func; diff --git a/lib/libc/mingw/stdio/atoll.c b/lib/libc/mingw/stdio/atoll.c deleted file mode 100644 index 278c01cf9257..000000000000 --- a/lib/libc/mingw/stdio/atoll.c +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#define __CRT__NO_INLINE -#include - -long long __cdecl atoll(const char * nptr) { return strtoll(nptr, NULL, 10); } -long long (__cdecl *__MINGW_IMP_SYMBOL(atoll))(const char *) = atoll; - -__int64 __attribute__((alias("atoll"))) __cdecl _atoi64(const char * nptr); -__int64 (__cdecl *__MINGW_IMP_SYMBOL(_atoi64))(const char *) = _atoi64; diff --git a/lib/libc/mingw/stdio/fseeki64.c b/lib/libc/mingw/stdio/fseeki64.c deleted file mode 100644 index f70062e39118..000000000000 --- a/lib/libc/mingw/stdio/fseeki64.c +++ /dev/null @@ -1,50 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -#include -#include - -#if !defined(__arm__) && !defined(__aarch64__) /* we have F_ARM_ANY(_fseeki64) in msvcrt.def.in */ -int __cdecl _fseeki64(FILE* stream, __int64 offset, int whence) -{ - fpos_t pos; - if (whence == SEEK_CUR) - { - /* If stream is invalid, fgetpos sets errno. */ - if (fgetpos (stream, &pos)) - return (-1); - pos += (fpos_t) offset; - } - else if (whence == SEEK_END) - { - /* If writing, we need to flush before getting file length. */ - fflush (stream); - pos = (fpos_t) (_filelengthi64 (_fileno (stream)) + offset); - } - else if (whence == SEEK_SET) - pos = (fpos_t) offset; - else - { - errno = EINVAL; - return (-1); - } - return fsetpos (stream, &pos); -} - -int __cdecl (*__MINGW_IMP_SYMBOL(_fseeki64))(FILE*, __int64, int) = _fseeki64; -#endif /* !defined(__arm__) && !defined(__aarch64__) */ - -__int64 __cdecl _ftelli64(FILE* stream) -{ - fpos_t pos; - if (fgetpos (stream, &pos)) - return -1LL; - else - return (__int64) pos; -} - -__int64 __cdecl (*__MINGW_IMP_SYMBOL(_ftelli64))(FILE*) = _ftelli64; - diff --git a/lib/libc/mingw/stdio/mingw_dummy__lock.c b/lib/libc/mingw/stdio/mingw_dummy__lock.c deleted file mode 100644 index 7afe665d0c98..000000000000 --- a/lib/libc/mingw/stdio/mingw_dummy__lock.c +++ /dev/null @@ -1,12 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include - -void __cdecl _lock(int locknum); -void __cdecl _unlock(int locknum); -void __cdecl _lock(__UNUSED_PARAM(int locknum)) { } -void __cdecl _unlock(__UNUSED_PARAM(int locknum)) { } diff --git a/lib/libc/mingw/stdio/mingw_lock.c b/lib/libc/mingw/stdio/mingw_lock.c deleted file mode 100644 index ebc3c256fecb..000000000000 --- a/lib/libc/mingw/stdio/mingw_lock.c +++ /dev/null @@ -1,102 +0,0 @@ -#define _CRTIMP -#include -#include -#include "internal.h" - -/*** - * Copy of MS functions _lock_file, _unlock_file which are missing from - * msvcrt.dll and msvcr80.dll. They are needed to atomic/lock stdio - * functions (printf, fprintf, vprintf, vfprintf). We need exactly the same - * lock that MS uses in msvcrt.dll because we can mix mingw-w64 code with - * original MS functions (puts, fputs for example). -***/ - - -_CRTIMP void __cdecl _lock(int locknum); -_CRTIMP void __cdecl _unlock(int locknum); -#define _STREAM_LOCKS 16 -#define _IOLOCKED 0x8000 - - -/*** -* _lock_file - Lock a FILE -* -*Purpose: -* Assert the lock for a stdio-level file -* -*Entry: -* pf = __piob[] entry (pointer to a FILE or _FILEX) -* -*Exit: -* -*Exceptions: -* -*******************************************************************************/ - -void __cdecl _lock_file( FILE *pf ) -{ - /* - * The way the FILE (pointed to by pf) is locked depends on whether - * it is part of _iob[] or not - */ - if ( (pf >= __acrt_iob_func(0)) && (pf <= __acrt_iob_func(_IOB_ENTRIES-1)) ) - { - /* - * FILE lies in _iob[] so the lock lies in _locktable[]. - */ - _lock( _STREAM_LOCKS + (int)(pf - __acrt_iob_func(0)) ); - /* We set _IOLOCKED to indicate we locked the stream */ - pf->_flag |= _IOLOCKED; - } - else - /* - * Not part of _iob[]. Therefore, *pf is a _FILEX and the - * lock field of the struct is an initialized critical - * section. - */ - EnterCriticalSection( &(((_FILEX *)pf)->lock) ); -} - -void *__MINGW_IMP_SYMBOL(_lock_file) = _lock_file; - - -/*** -* _unlock_file - Unlock a FILE -* -*Purpose: -* Release the lock for a stdio-level file -* -*Entry: -* pf = __piob[] entry (pointer to a FILE or _FILEX) -* -*Exit: -* -*Exceptions: -* -*******************************************************************************/ - -void __cdecl _unlock_file( FILE *pf ) -{ - /* - * The way the FILE (pointed to by pf) is unlocked depends on whether - * it is part of _iob[] or not - */ - if ( (pf >= __acrt_iob_func(0)) && (pf <= __acrt_iob_func(_IOB_ENTRIES-1)) ) - { - /* - * FILE lies in _iob[] so the lock lies in _locktable[]. - * We reset _IOLOCKED to indicate we unlock the stream. - */ - pf->_flag &= ~_IOLOCKED; - _unlock( _STREAM_LOCKS + (int)(pf - __acrt_iob_func(0)) ); - } - else - /* - * Not part of _iob[]. Therefore, *pf is a _FILEX and the - * lock field of the struct is an initialized critical - * section. - */ - LeaveCriticalSection( &(((_FILEX *)pf)->lock) ); -} - -void *__MINGW_IMP_SYMBOL(_unlock_file) = _unlock_file; diff --git a/lib/libc/mingw/stdio/snprintf_alias.c b/lib/libc/mingw/stdio/snprintf_alias.c deleted file mode 100644 index b9a892db3199..000000000000 --- a/lib/libc/mingw/stdio/snprintf_alias.c +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include -#include - -/* Intentionally not including stdio.h, as it unconditionally defines the - * snprintf inline, and it can't be renamed with "#define snprintf othername" - * either, as stdio.h contains "#undef snprintf". */ - -int __cdecl __ms_vsnprintf(char *buffer, size_t n, const char *format, va_list arg); - -int __cdecl snprintf(char *buffer, size_t n, const char *format, ...); -int __cdecl snprintf(char *buffer, size_t n, const char *format, ...) -{ - int retval; - va_list argptr; - - va_start(argptr, format); - retval = __ms_vsnprintf(buffer, n, format, argptr); - va_end(argptr); - return retval; -} diff --git a/lib/libc/mingw/stdio/strtof.c b/lib/libc/mingw/stdio/strtof.c deleted file mode 100644 index c4e4eb918a9b..000000000000 --- a/lib/libc/mingw/stdio/strtof.c +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -#include -#include -#include - -float strtof( const char *nptr, char **endptr) -{ - double ret = strtod(nptr, endptr); - if (isfinite(ret)) { - /* Check for cases that aren't out of range for doubles, but that are - * for floats. */ - if (ret > FLT_MAX) - errno = ERANGE; - else if (ret < -FLT_MAX) - errno = ERANGE; - else if (ret > 0 && ret < FLT_MIN) - errno = ERANGE; - else if (ret < 0 && ret > -FLT_MIN) - errno = ERANGE; - } - return ret; -} diff --git a/lib/libc/mingw/stdio/vsnprintf_alias.c b/lib/libc/mingw/stdio/vsnprintf_alias.c deleted file mode 100644 index d62a07f8515d..000000000000 --- a/lib/libc/mingw/stdio/vsnprintf_alias.c +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include -#include - -/* Intentionally not including stdio.h, as it unconditionally defines the - * vsnprintf inline, and it can't be renamed with "#define vsnprintf othername" - * either, as stdio.h contains "#undef vsnprintf". */ - -int __cdecl __ms_vsnprintf(char *buffer, size_t n, const char *format, va_list arg); - -int __cdecl vsnprintf(char *buffer, size_t n, const char *format, va_list arg); -int __cdecl vsnprintf(char *buffer, size_t n, const char *format, va_list arg) -{ - return __ms_vsnprintf(buffer, n, format, arg); -} diff --git a/tools/update_mingw.zig b/tools/update_mingw.zig index 8d708b7df4e2..ca8a9a1fc73a 100644 --- a/tools/update_mingw.zig +++ b/tools/update_mingw.zig @@ -148,7 +148,10 @@ const blacklist = [_][]const u8{ "msvcr80.def.in", "msvcr90.def.in", "msvcr90d.def.in", + "msvcrt.def.in", "msvcrt10.def.in", "msvcrt20.def.in", "msvcrt40.def.in", + + "crtdll.def.in", };