~ft/npe

686729f16636fe0310dcb4b3108a572b25c88106 — Sigrid Solveig Haflínudóttir 1 year, 4 months ago 4fa9b9a
leave fpu flags alone; more precise/portable versions of log2/exp2
5 files changed, 8 insertions(+), 6 deletions(-)

M libnpe/_main.c
M libnpe/_npe.h
M libnpe/exp2.c
M libnpe/log2.c
M libnpe_sdl2/audio.c
M libnpe/_main.c => libnpe/_main.c +0 -2
@@ 15,8 15,6 @@ npe_threadexit(int x)
void
threadmain(int argc, char *argv[])
{
	setfcr(getfcr() & ~(FPINVAL|FPOVFL));

	exit = npe_threadexit;

	argv0 = *argv; /* for sdl to set at least some kind of label */

M libnpe/_npe.h => libnpe/_npe.h +0 -1
@@ 1,3 1,2 @@
#define ln2o1 1.4426950408889634073599
#define hugeF 3.4028234e+38
#define hugeD 1.79769313486231e+308

M libnpe/exp2.c => libnpe/exp2.c +4 -1
@@ 4,5 4,8 @@
double
exp2(double x)
{
	return exp(x/ln2o1);
	static double ln2c = 0.0;
	if(ln2c == 0.0)
		ln2c = log(2.0);
	return exp(x*ln2c);
}

M libnpe/log2.c => libnpe/log2.c +4 -1
@@ 4,12 4,15 @@
double
log2(double x)
{
	static double ln2c = 0.0;
	if(x == 0)
		return -hugeD;
	if(x < 0 || isNaN(x))
		return NaN();
	if(ln2c == 0.0)
		ln2c = log(2.0);

	return log(x)*ln2o1;
	return log(x)/ln2c;
}

float

M libnpe_sdl2/audio.c => libnpe_sdl2/audio.c +0 -1
@@ 201,7 201,6 @@ SDL_OpenAudioDevice(char *dev, int rec, SDL_AudioSpec *want, SDL_AudioSpec *have
			dup(p[0], rec ? 1 : 0); close(p[0]);
			close(p[1]);
			//close(2);
			setfcr(FPPDBL|FPRNR|FPINVAL|FPZDIV|FPOVFL);
			if(execl("/bin/audio/pcmconv", "pcmconv", rec ? "-o" : "-i", spec, nil) != 0)
				exits("%r");
		}else if(a->pidconv < 0){