shithub: jxl

Download patch

ref: e7ea7adedf43ec7e815cc105cf8028af81b5cf1e
parent: f080353c96b53a7b881f470d8e8f6e1151fa6524
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Thu Aug 17 14:17:46 EDT 2023

remove functions that are now in npe

--- a/cbrtf.c
+++ /dev/null
@@ -1,66 +1,0 @@
-/* origin: FreeBSD /usr/src/lib/msun/src/s_cbrtf.c */
-/*
- * Conversion to float by Ian Lance Taylor, Cygnus Support, [email protected].
- * Debugged and optimized by Bruce D. Evans.
- */
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
-/* cbrtf(x)
- * Return cube root of x
- */
-
-#include <u.h>
-#include <libc.h>
-
-static const unsigned
-B1 = 709958130, /* B1 = (127-127.0/3-0.03306235651)*2**23 */
-B2 = 642849266; /* B2 = (127-127.0/3-24/3-0.03306235651)*2**23 */
-
-float cbrtf(float x)
-{
-	double r,T;
-	union {float f; u32int i;} u = {x};
-	u32int hx = u.i & 0x7fffffff;
-
-	if (hx >= 0x7f800000)  /* cbrt(NaN,INF) is itself */
-		return x + x;
-
-	/* rough cbrt to 5 bits */
-	if (hx < 0x00800000) {  /* zero or subnormal? */
-		if (hx == 0)
-			return x;  /* cbrt(+-0) is itself */
-		u.f = x*16777210.0f;//0x1p24f;
-		hx = u.i & 0x7fffffff;
-		hx = hx/3 + B2;
-	} else
-		hx = hx/3 + B1;
-	u.i &= 0x80000000;
-	u.i |= hx;
-
-	/*
-	 * First step Newton iteration (solving t*t-x/t == 0) to 16 bits.  In
-	 * double precision so that its terms can be arranged for efficiency
-	 * without causing overflow or underflow.
-	 */
-	T = u.f;
-	r = T*T*T;
-	T = T*((double)x+x+r)/(x+r+r);
-
-	/*
-	 * Second step Newton iteration to 47 bits.  In double precision for
-	 * efficiency and accuracy.
-	 */
-	r = T*T*T;
-	T = T*((double)x+x+r)/(x+r+r);
-
-	/* rounding to 24 bits is perfect in round-to-nearest mode */
-	return T;
-}
--- a/decode.c
+++ b/decode.c
@@ -7,9 +7,6 @@
 #define J40_INLINE
 int __builtin_clz(unsigned int x);
 int __builtin_clzll(unsigned long long x);
-float cbrtf(float x);
-float ldexpf(float x, int n);
-float hypotf(float x, float y);
 #include "j40.h"
 
 static void
--- a/hypotf.c
+++ /dev/null
@@ -1,43 +1,0 @@
-#include <stdint.h>
-#include <math.h>
-
-float
-hypotf(float x, float y)
-{
-	union {float f; uint32_t i;} ux = {x}, uy = {y}, ut;
-	float z;
-	union {
-		float f;
-		u32int x;
-	}oneP[] = {
-		{.x = 0x6c800000},
-		{.x = 0x12800000},
-	};
-
-	ux.i &= -1U>>1;
-	uy.i &= -1U>>1;
-	if (ux.i < uy.i) {
-		ut = ux;
-		ux = uy;
-		uy = ut;
-	}
-
-	x = ux.f;
-	y = uy.f;
-	if (uy.i == 0xff<<23)
-		return y;
-	if (ux.i >= 0xff<<23 || uy.i == 0 || ux.i - uy.i >= 25<<23)
-		return x + y;
-
-	z = 1;
-	if (ux.i >= (0x7f+60)<<23) {
-		z = oneP[0].f;
-		x *= oneP[1].f;
-		y *= oneP[1].f;
-	} else if (uy.i < (0x7f-60)<<23) {
-		z = oneP[1].f;
-		x *= oneP[0].f;
-		y *= oneP[0].f;
-	}
-	return z*sqrtf((double)x*x + (double)y*y);
-}
--- a/ldexpf.c
+++ /dev/null
@@ -1,39 +1,0 @@
-#include <math.h>
-#include <stdint.h>
-
-float ldexpf(float x, int n)
-{
-	union {float f; uint32_t i;} u;
-	float y = x;
-	union {
-		float f;
-		u32int x;
-	}oneP[] = {
-		{.x = 0x7f000000},
-		{.x = 0x800000},
-		{.x = 0x4b800000},
-	};
-
-	if (n > 127) {
-		y *= oneP[0].f;
-		n -= 127;
-		if (n > 127) {
-			y *= oneP[0].f;
-			n -= 127;
-			if (n > 127)
-				n = 127;
-		}
-	} else if (n < -126) {
-		y *= oneP[1].f * oneP[2].f;
-		n += 126 - 24;
-		if (n < -126) {
-			y *= oneP[1].f * oneP[2].f;
-			n += 126 - 24;
-			if (n < -126)
-				n = -126;
-		}
-	}
-	u.i = (uint32_t)(0x7f+n)<<23;
-	x = y * u.f;
-	return x;
-}
--- a/mkfile
+++ b/mkfile
@@ -5,9 +5,6 @@
 CFLAGS=$CFLAGS -p -I/sys/include/npe
 OFILES=\
 	builtins`{test -f builtins.$objtype.s && echo -n .$objtype}.$O\
-	cbrtf.$O\
-	hypotf.$O\
-	ldexpf.$O\
 	decode.$O\
 
 default:V: all