summaryrefslogtreecommitdiffstats
path: root/modules/fdlibm/patches/10_remove_unused_function_from_k_exp_cpp.patch
diff options
context:
space:
mode:
Diffstat (limited to 'modules/fdlibm/patches/10_remove_unused_function_from_k_exp_cpp.patch')
-rw-r--r--modules/fdlibm/patches/10_remove_unused_function_from_k_exp_cpp.patch107
1 files changed, 107 insertions, 0 deletions
diff --git a/modules/fdlibm/patches/10_remove_unused_function_from_k_exp_cpp.patch b/modules/fdlibm/patches/10_remove_unused_function_from_k_exp_cpp.patch
new file mode 100644
index 0000000000..0cd417bcd2
--- /dev/null
+++ b/modules/fdlibm/patches/10_remove_unused_function_from_k_exp_cpp.patch
@@ -0,0 +1,107 @@
+diff --git a/k_exp.cpp b/k_exp.cpp
+--- a/k_exp.cpp
++++ b/k_exp.cpp
+@@ -24,18 +24,16 @@
+ * 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/cdefs.h>
+ //__FBSDID("$FreeBSD$");
+
+-#include <complex.h>
+-
+ #include "math_private.h"
+
+ static const uint32_t k = 1799; /* constant for reduction */
+ static const double kln2 = 1246.97177782734161156; /* k * ln2 */
+
+ /*
+ * Compute exp(x), scaled to avoid spurious overflow. An exponent is
+ * returned separately in 'expt'.
+@@ -78,33 +76,8 @@ __ldexp_exp(double x, int expt)
+ double exp_x, scale;
+ int ex_expt;
+
+ exp_x = __frexp_exp(x, &ex_expt);
+ expt += ex_expt;
+ INSERT_WORDS(scale, (0x3ff + expt) << 20, 0);
+ return (exp_x * scale);
+ }
+-
+-double complex
+-__ldexp_cexp(double complex z, int expt)
+-{
+- double c, exp_x, s, scale1, scale2, x, y;
+- int ex_expt, half_expt;
+-
+- x = creal(z);
+- y = cimag(z);
+- exp_x = __frexp_exp(x, &ex_expt);
+- expt += ex_expt;
+-
+- /*
+- * Arrange so that scale1 * scale2 == 2**expt. We use this to
+- * compensate for scalbn being horrendously slow.
+- */
+- half_expt = expt / 2;
+- INSERT_WORDS(scale1, (0x3ff + half_expt) << 20, 0);
+- half_expt = expt - half_expt;
+- INSERT_WORDS(scale2, (0x3ff + half_expt) << 20, 0);
+-
+- sincos(y, &s, &c);
+- return (CMPLX(c * exp_x * scale1 * scale2,
+- s * exp_x * scale1 * scale2));
+-}
+--- a/k_expf.cpp 2022-12-13 14:39:11.791594163 -0500
++++ b/k_expf.cpp 2022-12-13 14:39:18.631622916 -0500
+@@ -24,18 +24,16 @@
+ * 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/cdefs.h>
+ //__FBSDID("$FreeBSD$");
+
+-#include <complex.h>
+-
+ #include "math_private.h"
+
+ static const uint32_t k = 235; /* constant for reduction */
+ static const float kln2 = 162.88958740F; /* k * ln2 */
+
+ /*
+ * See k_exp.c for details.
+ *
+@@ -61,29 +59,8 @@
+ float exp_x, scale;
+ int ex_expt;
+
+ exp_x = __frexp_expf(x, &ex_expt);
+ expt += ex_expt;
+ SET_FLOAT_WORD(scale, (0x7f + expt) << 23);
+ return (exp_x * scale);
+ }
+-
+-float complex
+-__ldexp_cexpf(float complex z, int expt)
+-{
+- float c, exp_x, s, scale1, scale2, x, y;
+- int ex_expt, half_expt;
+-
+- x = crealf(z);
+- y = cimagf(z);
+- exp_x = __frexp_expf(x, &ex_expt);
+- expt += ex_expt;
+-
+- half_expt = expt / 2;
+- SET_FLOAT_WORD(scale1, (0x7f + half_expt) << 23);
+- half_expt = expt - half_expt;
+- SET_FLOAT_WORD(scale2, (0x7f + half_expt) << 23);
+-
+- sincosf(y, &s, &c);
+- return (CMPLXF(c * exp_x * scale1 * scale2,
+- s * exp_x * scale1 * scale2));
+-}