From 3c0cd4da3737d13f72794d3ef276004077c8da01 Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Tue, 29 Aug 2006 17:51:13 +0000 Subject: [PATCH] 1. Rewote atan.c to pure asm 2. Rewote log10 to pure asm 3. Delete unuse c/asm files like ceil, cos, fabs, flor, sin, sqrt, and tan 4. Switch to rtl asm version of pow 5. Follow need be convert to asm atan2, exp, fmod, ldexp 6. Follow need c version atan2, exp, fmod, ldexp, atan, log10, pow 7. Add i386 arch dections in rbuild for asm/inline asm so we using only i386 asm on x86 cpu svn path=/trunk/; revision=23784 --- reactos/lib/crt/crt.rbuild | 29 ++++-- reactos/lib/crt/math/atan.c | 37 ------- reactos/lib/crt/math/ceil.c | 21 ---- reactos/lib/crt/math/cos.c | 19 ---- reactos/lib/crt/math/fabs.c | 36 ------- reactos/lib/crt/math/floor.c | 40 -------- reactos/lib/crt/math/i386/atan_asm.s | 22 ++++ reactos/lib/crt/math/i386/ceil_asm.s | 58 ----------- reactos/lib/crt/math/i386/cos_asm.s | 50 --------- reactos/lib/crt/math/i386/fabs_asm.s | 50 --------- reactos/lib/crt/math/i386/floor_asm.s | 58 ----------- reactos/lib/crt/math/i386/log10_asm.s | 25 +++++ reactos/lib/crt/math/i386/sin_asm.s | 50 --------- reactos/lib/crt/math/i386/sqrt_asm.s | 50 --------- reactos/lib/crt/math/i386/tan_asm.s | 53 ---------- reactos/lib/crt/math/log.c | 38 ------- reactos/lib/crt/math/log10.c | 38 ------- reactos/lib/crt/math/math.c | 120 ---------------------- reactos/lib/crt/math/pow.c | 97 ----------------- reactos/lib/crt/math/{sin.c => pow_asm.c} | 66 ++++++------ reactos/lib/crt/math/sqrt.c | 35 ------- reactos/lib/crt/math/tan.c | 37 ------- 22 files changed, 97 insertions(+), 932 deletions(-) delete mode 100644 reactos/lib/crt/math/atan.c delete mode 100644 reactos/lib/crt/math/ceil.c delete mode 100644 reactos/lib/crt/math/cos.c delete mode 100644 reactos/lib/crt/math/fabs.c delete mode 100644 reactos/lib/crt/math/floor.c create mode 100644 reactos/lib/crt/math/i386/atan_asm.s delete mode 100644 reactos/lib/crt/math/i386/ceil_asm.s delete mode 100644 reactos/lib/crt/math/i386/cos_asm.s delete mode 100644 reactos/lib/crt/math/i386/fabs_asm.s delete mode 100644 reactos/lib/crt/math/i386/floor_asm.s create mode 100644 reactos/lib/crt/math/i386/log10_asm.s delete mode 100644 reactos/lib/crt/math/i386/sin_asm.s delete mode 100644 reactos/lib/crt/math/i386/sqrt_asm.s delete mode 100644 reactos/lib/crt/math/i386/tan_asm.s delete mode 100644 reactos/lib/crt/math/log.c delete mode 100644 reactos/lib/crt/math/log10.c delete mode 100644 reactos/lib/crt/math/math.c delete mode 100644 reactos/lib/crt/math/pow.c rename reactos/lib/crt/math/{sin.c => pow_asm.c} (81%) delete mode 100644 reactos/lib/crt/math/sqrt.c delete mode 100644 reactos/lib/crt/math/tan.c diff --git a/reactos/lib/crt/crt.rbuild b/reactos/lib/crt/crt.rbuild index 01667c651f5..7ff54e565cc 100644 --- a/reactos/lib/crt/crt.rbuild +++ b/reactos/lib/crt/crt.rbuild @@ -105,27 +105,38 @@ acos.c adjust.c - asin.c - atan2.c + asin.c cabs.c - cosh.c - exp.c - fmod.c + cosh.c frexp.c huge_val.c hypot.c j0_y0.c j1_y1.c - jn_yn.c - ldexp.c - log10.c + jn_yn.c modf.c s_modf.c - pow.c sinh.c stubs.c tanh.c + pow_asm.c + + + atan2.c + exp.c + fmod.c + ldexp.c + + + atan_asm.s + pow_asm.s + log10_asm.s + + + + + hanzen.c ischira.c diff --git a/reactos/lib/crt/math/atan.c b/reactos/lib/crt/math/atan.c deleted file mode 100644 index 7c5adcf3466..00000000000 --- a/reactos/lib/crt/math/atan.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Math functions for i387. - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by John C. Bowman , 1995. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -double atan (double __x); - -double atan (double __x) -{ - register double __value; -#ifdef __GNUC__ - __asm __volatile__ - ("fld1\n\t" - "fpatan" - : "=t" (__value) : "0" (__x)); -#else - __value = linkme_atan(__x); -#endif /*__GNUC__*/ - return __value; -} diff --git a/reactos/lib/crt/math/ceil.c b/reactos/lib/crt/math/ceil.c deleted file mode 100644 index 43dd120bad8..00000000000 --- a/reactos/lib/crt/math/ceil.c +++ /dev/null @@ -1,21 +0,0 @@ -#include - -/* - * @implemented - */ -double ceil (double __x) -{ - register double __value; -#ifdef __GNUC__ - __volatile unsigned short int __cw, __cwtmp; - - __asm __volatile ("fnstcw %0" : "=m" (__cw)); - __cwtmp = (__cw & 0xf3ff) | 0x0800; /* rounding up */ - __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); - __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); - __asm __volatile ("fldcw %0" : : "m" (__cw)); -#else - __value = linkme_ceil(__x); -#endif /*__GNUC__*/ - return __value; -} diff --git a/reactos/lib/crt/math/cos.c b/reactos/lib/crt/math/cos.c deleted file mode 100644 index 95657c6e884..00000000000 --- a/reactos/lib/crt/math/cos.c +++ /dev/null @@ -1,19 +0,0 @@ -#include - -double cos (double __x); - -/* - * @implemented - */ -double cos (double __x) -{ - register double __value; -#ifdef __GNUC__ - __asm __volatile__ - ("fcos" - : "=t" (__value): "0" (__x)); -#else - __value = linkme_cos(__x); -#endif /*__GNUC__*/ - return __value; -} diff --git a/reactos/lib/crt/math/fabs.c b/reactos/lib/crt/math/fabs.c deleted file mode 100644 index 3c61ab1ad17..00000000000 --- a/reactos/lib/crt/math/fabs.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Math functions for i387. - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by John C. Bowman , 1995. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -double fabs (double __x); - -double fabs (double __x) -{ - register double __value; -#ifdef __GNUC__ - __asm __volatile__ - ("fabs" - : "=t" (__value) : "0" (__x)); -#else - __value = linkme_fabs(__x); -#endif /*__GNUC__*/ - return __value; -} diff --git a/reactos/lib/crt/math/floor.c b/reactos/lib/crt/math/floor.c deleted file mode 100644 index 684b7163c82..00000000000 --- a/reactos/lib/crt/math/floor.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Math functions for i387. - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by John C. Bowman , 1995. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -double floor (double __x); - -double floor (double __x) -{ - register double __value; -#ifdef __GNUC__ - __volatile unsigned short int __cw, __cwtmp; - - __asm __volatile ("fnstcw %0" : "=m" (__cw)); - __cwtmp = (__cw & 0xf3ff) | 0x0400; /* rounding down */ - __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); - __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); - __asm __volatile ("fldcw %0" : : "m" (__cw)); -#else - __value = linkme_floor(__x); -#endif /*__GNUC__*/ - return __value; -} diff --git a/reactos/lib/crt/math/i386/atan_asm.s b/reactos/lib/crt/math/i386/atan_asm.s new file mode 100644 index 00000000000..0698a4ad7fc --- /dev/null +++ b/reactos/lib/crt/math/i386/atan_asm.s @@ -0,0 +1,22 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * PURPOSE: + * FILE: + * PROGRAMER: Magnus Olsen (magnus@greatlord.com) + * + */ + +.globl _atan + +.intel_syntax noprefix + +/* FUNCTIONS ***************************************************************/ + +_atan: + push ebp + mov ebp,esp + fld qword ptr [ebp+8] + fpatan + pop ebp + ret diff --git a/reactos/lib/crt/math/i386/ceil_asm.s b/reactos/lib/crt/math/i386/ceil_asm.s deleted file mode 100644 index e6cdd452c7b..00000000000 --- a/reactos/lib/crt/math/i386/ceil_asm.s +++ /dev/null @@ -1,58 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Run-Time Library - * FILE: lib/rtl/i386/ceil.S - * PROGRAMER: Alex Ionescu (alex@relsoft.net) - * Eric Kohl (ekohl@rz-online.de) - * - * Copyright (C) 2002 Michael Ringgaard. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS 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 OWNER OR CONTRIBUTORS 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. - */ - -.globl _ceil - -.intel_syntax noprefix - -/* FUNCTIONS ***************************************************************/ - -_ceil: - push ebp - mov ebp,esp - sub esp,4 // Allocate temporary space - fld qword ptr [ebp+8] // Load real from stack - fstcw [ebp-2] // Save control word - fclex // Clear exceptions - mov word ptr [ebp-4],0xb63 // Rounding control word - fldcw [ebp-4] // Set new rounding control - frndint // Round to integer - fclex // Clear exceptions - fldcw [ebp-2] // Restore control word - mov esp,ebp // Deallocate temporary space - pop ebp - ret diff --git a/reactos/lib/crt/math/i386/cos_asm.s b/reactos/lib/crt/math/i386/cos_asm.s deleted file mode 100644 index ba4ea3698a7..00000000000 --- a/reactos/lib/crt/math/i386/cos_asm.s +++ /dev/null @@ -1,50 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Run-Time Library - * FILE: lib/rtl/i386/cos.S - * PROGRAMER: Alex Ionescu (alex@relsoft.net) - * Eric Kohl (ekohl@rz-online.de) - * - * Copyright (C) 2002 Michael Ringgaard. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS 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 OWNER OR CONTRIBUTORS 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. - */ - -.globl _cos - -.intel_syntax noprefix - -/* FUNCTIONS ***************************************************************/ - -_cos: - push ebp - mov ebp,esp // Point to the stack frame - fld qword ptr [ebp+8] // Load real from stack - fcos // Take the cosine - pop ebp - ret diff --git a/reactos/lib/crt/math/i386/fabs_asm.s b/reactos/lib/crt/math/i386/fabs_asm.s deleted file mode 100644 index 7216b8160de..00000000000 --- a/reactos/lib/crt/math/i386/fabs_asm.s +++ /dev/null @@ -1,50 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Run-Time Library - * FILE: lib/rtl/i386/fabs.S - * PROGRAMER: Alex Ionescu (alex@relsoft.net) - * Eric Kohl (ekohl@rz-online.de) - * - * Copyright (C) 2002 Michael Ringgaard. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS 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 OWNER OR CONTRIBUTORS 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. - */ - -.globl _fabs - -.intel_syntax noprefix - -/* FUNCTIONS ***************************************************************/ - -_fabs: - push ebp - mov ebp,esp - fld qword ptr [ebp+8] // Load real from stack - fabs // Take the absolute value - pop ebp - ret diff --git a/reactos/lib/crt/math/i386/floor_asm.s b/reactos/lib/crt/math/i386/floor_asm.s deleted file mode 100644 index f3c9e0fe5ed..00000000000 --- a/reactos/lib/crt/math/i386/floor_asm.s +++ /dev/null @@ -1,58 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Run-Time Library - * FILE: lib/rtl/i386/floor.S - * PROGRAMER: Alex Ionescu (alex@relsoft.net) - * Eric Kohl (ekohl@rz-online.de) - * - * Copyright (C) 2002 Michael Ringgaard. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS 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 OWNER OR CONTRIBUTORS 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. - */ - -.globl _floor - -.intel_syntax noprefix - -/* FUNCTIONS ***************************************************************/ - -_floor: - push ebp - mov ebp,esp - sub esp,4 // Allocate temporary space - fld qword ptr [ebp+8] // Load real from stack - fstcw [ebp-2] // Save control word - fclex // Clear exceptions - mov word ptr [ebp-4],0x763 // Rounding control word - fldcw [ebp-4] // Set new rounding control - frndint // Round to integer - fclex // Clear exceptions - fldcw [ebp-2] // Restore control word - mov esp,ebp - pop ebp - ret diff --git a/reactos/lib/crt/math/i386/log10_asm.s b/reactos/lib/crt/math/i386/log10_asm.s new file mode 100644 index 00000000000..d1680445112 --- /dev/null +++ b/reactos/lib/crt/math/i386/log10_asm.s @@ -0,0 +1,25 @@ + + /* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * PURPOSE: + * FILE: + * PROGRAMER: Magnus Olsen (magnus@greatlord.com) + * + */ + +.globl _log10 + +.intel_syntax noprefix + +/* FUNCTIONS ***************************************************************/ + +_log10: + push ebp + mov ebp,esp + fld qword ptr [ebp+8] + fldlg2 + fyl2x + pop ebp + ret + diff --git a/reactos/lib/crt/math/i386/sin_asm.s b/reactos/lib/crt/math/i386/sin_asm.s deleted file mode 100644 index 3051e2543e9..00000000000 --- a/reactos/lib/crt/math/i386/sin_asm.s +++ /dev/null @@ -1,50 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Run-Time Library - * FILE: lib/rtl/i386/sin.S - * PROGRAMER: Alex Ionescu (alex@relsoft.net) - * Eric Kohl (ekohl@rz-online.de) - * - * Copyright (C) 2002 Michael Ringgaard. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS 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 OWNER OR CONTRIBUTORS 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. - */ - -.globl _sin - -.intel_syntax noprefix - -/* FUNCTIONS ***************************************************************/ - -_sin: - push ebp // Save register bp - mov ebp,esp // Point to the stack frame - fld qword ptr [ebp+8] // Load real from stack - fsin // Take the sine - pop ebp // Restore register bp - ret diff --git a/reactos/lib/crt/math/i386/sqrt_asm.s b/reactos/lib/crt/math/i386/sqrt_asm.s deleted file mode 100644 index a97b69953b6..00000000000 --- a/reactos/lib/crt/math/i386/sqrt_asm.s +++ /dev/null @@ -1,50 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Run-Time Library - * FILE: lib/rtl/i386/sqrt.S - * PROGRAMER: Alex Ionescu (alex@relsoft.net) - * Eric Kohl (ekohl@rz-online.de) - * - * Copyright (C) 2002 Michael Ringgaard. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS 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 OWNER OR CONTRIBUTORS 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. - */ - -.globl _sqrt - -.intel_syntax noprefix - -/* FUNCTIONS ***************************************************************/ - -_sqrt: - push ebp - mov ebp,esp - fld qword ptr [ebp+8] // Load real from stack - fsqrt // Take the square root - pop ebp - ret diff --git a/reactos/lib/crt/math/i386/tan_asm.s b/reactos/lib/crt/math/i386/tan_asm.s deleted file mode 100644 index 5d6ed98c839..00000000000 --- a/reactos/lib/crt/math/i386/tan_asm.s +++ /dev/null @@ -1,53 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Run-Time Library - * FILE: lib/rtl/i386/tan.S - * PROGRAMER: Alex Ionescu (alex@relsoft.net) - * Eric Kohl (ekohl@rz-online.de) - * - * Copyright (C) 2002 Michael Ringgaard. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS 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 OWNER OR CONTRIBUTORS 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. - */ - -.globl _tan - -.intel_syntax noprefix - -/* FUNCTIONS ***************************************************************/ - -_tan: - push ebp - mov ebp,esp - sub esp,4 // Allocate temporary space - fld qword ptr [ebp+8] // Load real from stack - fptan // Take the tangent - fstp dword ptr [ebp-4] // Throw away the constant 1 - mov esp,ebp // Deallocate temporary space - pop ebp - ret diff --git a/reactos/lib/crt/math/log.c b/reactos/lib/crt/math/log.c deleted file mode 100644 index bb1e524f520..00000000000 --- a/reactos/lib/crt/math/log.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Math functions for i387. - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by John C. Bowman , 1995. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -double log (double __x); - -double log (double __x) -{ - register double __value; -#ifdef __GNUC__ - __asm __volatile__ - ("fldln2\n\t" - "fxch\n\t" - "fyl2x" - : "=t" (__value) : "0" (__x)); -#else - __value = linkme_log(__x); -#endif /*__GNUC__*/ - return __value; -} diff --git a/reactos/lib/crt/math/log10.c b/reactos/lib/crt/math/log10.c deleted file mode 100644 index 743977a16de..00000000000 --- a/reactos/lib/crt/math/log10.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Math functions for i387. - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by John C. Bowman , 1995. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -double log10 (double __x); - -double log10 (double __x) -{ - register double __val; -#ifdef __GNUC__ - __asm __volatile__ - ("fldlg2\n\t" - "fxch\n\t" - "fyl2x" - : "=t" (__val) : "0" (__x)); -#else - __val = linkme_log10(__x); -#endif /*__GNUC__*/ - return __val; -} diff --git a/reactos/lib/crt/math/math.c b/reactos/lib/crt/math/math.c deleted file mode 100644 index ff1d0e266f9..00000000000 --- a/reactos/lib/crt/math/math.c +++ /dev/null @@ -1,120 +0,0 @@ -#include - -#pragma function(fmod,sqrt) -#pragma function(log,log10,pow,exp) -#pragma function(tan,atan,atan2,tanh) -#pragma function(cos,acos,cosh) -#pragma function(sin,asin,sinh) - - -double linkme_ceil(double __x) -{ - return ceil(__x); -} - -double linkme_fabs(double __x) -{ - return fabs(__x); -} - -double linkme_floor(double __x) -{ - return floor(__x); -} - -double linkme_ldexp(double __x, int __y) -{ - return ldexp(__x, __y); -} - -double linkme_log2(double __x) -{ - //return log2(__x); - return 0; -} - -double linkme_fmod(double __x, double __y) -{ - return fmod(__x, __y); -} - -double linkme_sqrt(double __x) -{ - return sqrt(__x); -} - -double linkme_log(double __x) -{ - return log(__x); -} - -double linkme_log10(double __x) -{ - return log10(__x); -} - -double linkme_pow(double __x, double __y) -{ - return pow(__x, __y); -} - -double linkme_exp(double __x) -{ - return exp(__x); -} - -double linkme_tan(double __x) -{ - return tan(__x); -} - -double linkme_atan(double __x) -{ - return atan(__x); -} - -double linkme_atan2(double __x, double __y) -{ - return atan2(__x, __y); -} - -double linkme_tanh(double __x) -{ - return tanh(__x); -} - -double linkme_cos(double __x) -{ - return cos(__x); -} - -double linkme_acos(double __x) -{ - return acos(__x); -} - -double linkme_cosh(double __x) -{ - return cosh(__x); -} - -double linkme_sin(double __x) -{ - return sin(__x); -} - -double linkme_asin(double __x) -{ - return asin(__x); -} - -double linkme_sinh(double __x) -{ - return sinh(__x); -} -/* -linkme_log2 -linkme_floor -_linkme_ldexp -_linkme_pow - */ diff --git a/reactos/lib/crt/math/pow.c b/reactos/lib/crt/math/pow.c deleted file mode 100644 index af40f594c3b..00000000000 --- a/reactos/lib/crt/math/pow.c +++ /dev/null @@ -1,97 +0,0 @@ -/* Math functions for i387. - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by John C. Bowman , 1995. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -double pow (double __x, double __y); - -double __log2 (double __x); - -double __log2 (double __x) -{ - register double __val; -#ifdef __GNUC__ - __asm __volatile__ - ("fld1\n\t" - "fxch\n\t" - "fyl2x" - : "=t" (__val) : "0" (__x)); -#else - //__value = linkme_log2(__x); - __val = 0; -#endif /*__GNUC__*/ - return __val; -} - -/* - * @implemented - */ -double pow (double __x, double __y) -{ - register double __val; -#ifdef __GNUC__ - register double __exponent; - long __p = (long) __y; - - if (__x == 0.0 && __y > 0.0) - return 0.0; - if (__y == (double) __p) - { - double __r = 1.0; - if (__p == 0) - return 1.0; - if (__p < 0) - { - __p = -__p; - __x = 1.0 / __x; - } - while (1) - { - if (__p & 1) - __r *= __x; - __p >>= 1; - if (__p == 0) - return __r; - __x *= __x; - } - /* NOTREACHED */ - } - __asm __volatile__ - ("fmul %%st(1) # y * log2(x)\n\t" - "fst %%st(1)\n\t" - "frndint # int(y * log2(x))\n\t" - "fxch\n\t" - "fsub %%st(1) # fract(y * log2(x))\n\t" - "f2xm1 # 2^(fract(y * log2(x))) - 1\n\t" - : "=t" (__val), "=u" (__exponent) : "0" (__log2 (__x)), "1" (__y)); - __val += 1.0; - __asm __volatile__ - ("fscale" - : "=t" (__val) : "0" (__val), "u" (__exponent)); -#else - __val = linkme_pow(__x, __y); -#endif /*__GNUC__*/ - return __val; -} - -long double powl (long double __x,long double __y) -{ - return pow(__x,__y/2)*pow(__x,__y/2); -} diff --git a/reactos/lib/crt/math/sin.c b/reactos/lib/crt/math/pow_asm.c similarity index 81% rename from reactos/lib/crt/math/sin.c rename to reactos/lib/crt/math/pow_asm.c index 576a4dc3fd8..999df73b242 100644 --- a/reactos/lib/crt/math/sin.c +++ b/reactos/lib/crt/math/pow_asm.c @@ -1,36 +1,30 @@ -/* Math functions for i387. - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by John C. Bowman , 1995. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -double sin (double __x); - -double sin (double __x) -{ - register double __value; -#ifdef __GNUC__ - __asm __volatile__ - ("fsin" - : "=t" (__value) : "0" (__x)); -#else - __value = linkme_sin(__x); -#endif /*__GNUC__*/ - return __value; -} +/* Math functions for i387. + Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by John C. Bowman , 1995. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +/* + * @implemented + */ + +long double powl (long double __x,long double __y) +{ + return pow(__x,__y/2)*pow(__x,__y/2); +} diff --git a/reactos/lib/crt/math/sqrt.c b/reactos/lib/crt/math/sqrt.c deleted file mode 100644 index fbae29c9ce2..00000000000 --- a/reactos/lib/crt/math/sqrt.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Math functions for i387. - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by John C. Bowman , 1995. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ -#include - -double sqrt (double __x); - -double sqrt (double __x) -{ - register double __value; -#ifdef __GNUC__ - __asm __volatile__ - ("fsqrt" - : "=t" (__value) : "0" (__x)); -#else - __value = linkme_sqrt(__x); -#endif /*__GNUC__*/ - return __value; -} diff --git a/reactos/lib/crt/math/tan.c b/reactos/lib/crt/math/tan.c deleted file mode 100644 index 1200eea6459..00000000000 --- a/reactos/lib/crt/math/tan.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Math functions for i387. - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by John C. Bowman , 1995. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -double tan (double __x); - -double tan (double __x) -{ - register double __value; -#ifdef __GNUC__ - register double __value2 __attribute__ ((unused)); - __asm __volatile__ - ("fptan" - : "=t" (__value2), "=u" (__value) : "0" (__x)); -#else - __value = linkme_tan(__x); -#endif /*__GNUC__*/ - return __value; -}