Fixed arch Jamfile to not use OBOS_TARGET_DIR any longer.
Added math-arch PPC files - general status: working but not optimized. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3145 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
a0c16735c9
commit
80403b993b
@ -1,3 +1,3 @@
|
||||
SubDir OBOS_TOP src kernel libroot posix math arch ;
|
||||
|
||||
SubInclude OBOS_TOP src kernel libroot posix math arch $(OBOS_TARGET_DIR) ;
|
||||
SubInclude OBOS_TOP src kernel libroot posix math arch $(OBOS_ARCH) ;
|
||||
|
10
src/kernel/libroot/posix/math/arch/ppc/Jamfile
Normal file
10
src/kernel/libroot/posix/math/arch/ppc/Jamfile
Normal file
@ -0,0 +1,10 @@
|
||||
SubDir OBOS_TOP src kernel libroot posix math arch ppc ;
|
||||
|
||||
KernelMergeObject posix_math_arch_$(OBOS_ARCH).o :
|
||||
<$(SOURCE_GRIST)>fabs.c
|
||||
<$(SOURCE_GRIST)>frexp.c
|
||||
<$(SOURCE_GRIST)>isinf.c
|
||||
<$(SOURCE_GRIST)>ldexp.c
|
||||
:
|
||||
-fPIC -DPIC
|
||||
;
|
18
src/kernel/libroot/posix/math/arch/ppc/fabs.c
Normal file
18
src/kernel/libroot/posix/math/arch/ppc/fabs.c
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
||||
double
|
||||
fabs(double value)
|
||||
{
|
||||
// ToDo: that's a slow, generic implementation
|
||||
if (value > 0)
|
||||
return value;
|
||||
|
||||
return -value;
|
||||
}
|
60
src/kernel/libroot/posix/math/arch/ppc/frexp.c
Normal file
60
src/kernel/libroot/posix/math/arch/ppc/frexp.c
Normal file
@ -0,0 +1,60 @@
|
||||
/* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
|
||||
*/
|
||||
|
||||
|
||||
#include <math.h>
|
||||
|
||||
double
|
||||
frexp(value, eptr)
|
||||
double value;
|
||||
int *eptr;
|
||||
{
|
||||
union {
|
||||
double v;
|
||||
struct {
|
||||
unsigned u_mant2 : 32;
|
||||
unsigned u_mant1 : 20;
|
||||
unsigned u_exp : 11;
|
||||
unsigned u_sign : 1;
|
||||
} s;
|
||||
} u;
|
||||
|
||||
if (value) {
|
||||
u.v = value;
|
||||
*eptr = u.s.u_exp - 1022;
|
||||
u.s.u_exp = 1022;
|
||||
return(u.v);
|
||||
} else {
|
||||
*eptr = 0;
|
||||
return((double)0);
|
||||
}
|
||||
}
|
68
src/kernel/libroot/posix/math/arch/ppc/isinf.c
Normal file
68
src/kernel/libroot/posix/math/arch/ppc/isinf.c
Normal file
@ -0,0 +1,68 @@
|
||||
/* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <math.h>
|
||||
|
||||
/* ToDo: on BeOS/x86, these are defined as __isnan(), and __isinf() - the
|
||||
* isnan()/isinf() are only macros - we will have to reflect this here.
|
||||
*/
|
||||
|
||||
int isnan(double);
|
||||
int isinf(double);
|
||||
|
||||
int
|
||||
isnan(double d)
|
||||
{
|
||||
register struct IEEEdp {
|
||||
unsigned manl : 32;
|
||||
unsigned manh : 20;
|
||||
unsigned exp : 11;
|
||||
unsigned sign : 1;
|
||||
} *p = (struct IEEEdp *)&d;
|
||||
|
||||
return p->exp == 2047 && (p->manh || p->manl);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
isinf(double d)
|
||||
{
|
||||
register struct IEEEdp {
|
||||
u_int manl : 32;
|
||||
u_int manh : 20;
|
||||
u_int exp : 11;
|
||||
u_int sign : 1;
|
||||
} *p = (struct IEEEdp *)&d;
|
||||
|
||||
return p->exp == 2047 && !p->manh && !p->manl;
|
||||
}
|
19
src/kernel/libroot/posix/math/arch/ppc/ldexp.c
Normal file
19
src/kernel/libroot/posix/math/arch/ppc/ldexp.c
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
||||
double
|
||||
ldexp(double value, int exp)
|
||||
{
|
||||
// ToDo: that's a slow, generic implementation
|
||||
double power = 1.;
|
||||
while (exp-- > 0)
|
||||
power *= 2.;
|
||||
|
||||
return value * power;
|
||||
}
|
Loading…
Reference in New Issue
Block a user