ack subdir for combined ack/gcc library build

This commit is contained in:
Ben Gras
2005-10-10 15:27:47 +00:00
parent 04822e9cc9
commit 8c53e4007e
322 changed files with 17865 additions and 0 deletions

13
lib/ack/math/Makefile Normal file
View File

@@ -0,0 +1,13 @@
# Makefile for lib/ack/math.
CFLAGS = -O -D_MINIX -D_POSIX_SOURCE
LIBRARIES = libc
libc_OBJECTS = \
frexp.o \
modf.o \
isnan.o \
ldexp.o \
include ../../Makefile.ack.inc

29
lib/ack/math/Makefile.ack.conv Executable file
View File

@@ -0,0 +1,29 @@
# Makefile for lib/math.
CFLAGS = -O -D_MINIX -D_POSIX_SOURCE
CC1 = $(CC) $(CFLAGS) -c
LIBRARY = ../../libc.a
all: $(LIBRARY)
OBJECTS = \
$(LIBRARY)(frexp.o) \
$(LIBRARY)(modf.o) \
$(LIBRARY)(isnan.o) \
$(LIBRARY)(ldexp.o) \
$(LIBRARY): $(OBJECTS)
aal cr $@ *.o
rm *.o
$(LIBRARY)(frexp.o): frexp.s
$(CC1) frexp.s
$(LIBRARY)(modf.o): modf.s
$(CC1) modf.s
$(LIBRARY)(isnan.o): isnan.c
$(CC1) isnan.c
$(LIBRARY)(ldexp.o): ldexp.c
$(CC1) ldexp.c

35
lib/ack/math/frexp.s Executable file
View File

@@ -0,0 +1,35 @@
#
.sect .text; .sect .rom; .sect .data; .sect .bss
.extern _frexp
.sect .text
_frexp:
#if __i386
push ebp
mov ebp, esp
push 12(ebp)
push 8(ebp)
mov eax, esp
add eax, -4
push eax
call .fef8
mov eax, 16(ebp)
pop (eax)
pop eax
pop edx
leave
ret
#else /* i86 */
push bp
mov bp, sp
lea bx, 4(bp)
mov cx, #8
call .loi
mov ax, sp
add ax, #-2
push ax
call .fef8
mov bx, 12(bp)
pop (bx)
call .ret8
jmp .cret
#endif

11
lib/ack/math/isnan.c Executable file
View File

@@ -0,0 +1,11 @@
int __IsNan(double d)
{
#if defined(vax) || defined(pdp)
#else
float f = d;
if ((*((long *) &f) & 0x7f800000) == 0x7f800000 &&
(*((long *) &f) & 0x007fffff) != 0) return 1;
#endif
return 0;
}

55
lib/ack/math/ldexp.c Executable file
View File

@@ -0,0 +1,55 @@
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Header$ */
#include <math.h>
#include <float.h>
#include <errno.h>
double
ldexp(double fl, int exp)
{
int sign = 1;
int currexp;
if (__IsNan(fl)) {
errno = EDOM;
return fl;
}
if (fl == 0.0) return 0.0;
if (fl<0) {
fl = -fl;
sign = -1;
}
if (fl > DBL_MAX) { /* for infinity */
errno = ERANGE;
return sign * fl;
}
fl = frexp(fl,&currexp);
exp += currexp;
if (exp > 0) {
if (exp > DBL_MAX_EXP) {
errno = ERANGE;
return sign * HUGE_VAL;
}
while (exp>30) {
fl *= (double) (1L << 30);
exp -= 30;
}
fl *= (double) (1L << exp);
}
else {
/* number need not be normalized */
if (exp < DBL_MIN_EXP - DBL_MANT_DIG) {
return 0.0;
}
while (exp<-30) {
fl /= (double) (1L << 30);
exp += 30;
}
fl /= (double) (1L << -exp);
}
return sign * fl;
}

49
lib/ack/math/modf.s Executable file
View File

@@ -0,0 +1,49 @@
#
.sect .text; .sect .rom; .sect .data; .sect .bss
.extern _modf
.sect .text
_modf:
#if __i386
push ebp
mov ebp, esp
push 12(ebp)
push 8(ebp)
push 1
push 4
call .cif8
mov eax, esp
push eax
call .fif8
pop ecx
mov edx, 16(ebp)
pop ecx
pop ebx
mov 0(edx), ecx
mov 4(edx), ebx
pop eax
pop edx
leave
ret
#else /* i86 */
push bp
mov bp, sp
lea bx, 4(bp)
mov cx, #8
call .loi
mov dx, #1
push dx
push dx
push dx
mov ax, #2
push ax
call .cif8
mov ax, sp
push ax
call .fif8
pop bx
mov bx, 12(bp)
mov cx, #8
call .sti
call .ret8
jmp .cret
#endif