diff options
author | 2013-07-15 18:05:14 +0000 | |
---|---|---|
committer | 2013-07-15 18:05:14 +0000 | |
commit | 19cfa30c387840cbaa9bef020bd9299cd6ad4c3d (patch) | |
tree | 0c2cfc35e5e5599d94d415cf88605675b3b69767 | |
parent | Use bus_space_set_region_4 instead of looping over bus_space_write_4, (diff) | |
download | wireguard-openbsd-19cfa30c387840cbaa9bef020bd9299cd6ad4c3d.tar.xz wireguard-openbsd-19cfa30c387840cbaa9bef020bd9299cd6ad4c3d.zip |
use some generic code on vax, to do round/roundf/scalbln...
suggested by martynas@
okay miod@
(just rearranges the !vax makefile, no compile change there)
-rw-r--r-- | lib/libm/Makefile | 10 | ||||
-rw-r--r-- | lib/libm/noieee_src/n_round.c | 47 | ||||
-rw-r--r-- | lib/libm/noieee_src/n_scalbln.c | 31 |
3 files changed, 5 insertions, 83 deletions
diff --git a/lib/libm/Makefile b/lib/libm/Makefile index b92a50baed1..dfa09fd3a4c 100644 --- a/lib/libm/Makefile +++ b/lib/libm/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.103 2013/07/03 10:26:49 espie Exp $ +# $OpenBSD: Makefile,v 1.104 2013/07/15 18:05:14 espie Exp $ # $NetBSD: Makefile,v 1.28 1995/11/20 22:06:19 jtc Exp $ # # @(#)Makefile 5.1beta 93/09/24 @@ -119,8 +119,8 @@ COMMON_SRCS = b_exp__D.c b_log__D.c b_tgamma.c \ s_log1pf.c s_logb.c s_logbf.c s_llrint.c s_llrintf.c s_lrint.c \ s_lrintf.c s_modff.c s_nan.c s_nearbyint.c s_nextafter.c \ s_nextafterf.c s_nexttowardf.c s_remquo.c s_remquof.c s_rint.c \ - s_rintf.c s_round.c s_roundf.c \ - s_scalbln.c s_scalbn.c s_scalbnf.c s_signgam.c s_significand.c \ + s_rintf.c \ + s_scalbn.c s_scalbnf.c s_signgam.c s_significand.c \ s_significandf.c \ s_sin.c s_sinf.c s_tan.c s_tanf.c s_tanh.c s_tanhf.c s_trunc.c \ s_truncf.c w_drem.c w_dremf.c w_gamma.c w_gamma_r.c w_gammaf.c \ @@ -148,7 +148,7 @@ NOIEEE_SRCS = n_acosh.c n_asincos.c n_asinh.c n_atan.c \ n_erf.c n_exp.c n_exp__E.c n_expm1.c n_floor.c \ n_fmod.c \ n_j0.c n_j1.c n_jn.c n_lgamma.c n_log.c n_log10.c \ - n_log1p.c n_log__L.c n_nan.c n_pow.c n_round.c n_scalbln.c \ + n_log1p.c n_log__L.c n_nan.c n_pow.c \ n_sinh.c n_tanh.c n_tgamma.c # there for reference, they're replaced by an asm version on vax NOIEEE_SRCS += n_argred.c n_atan2.c n_cbrt.c n_hypot.c n_infnan.c \ @@ -160,7 +160,7 @@ PURE_SRCS = s_cabs.c s_cacos.c s_cacosh.c s_carg.c s_casin.c \ s_cimag.c s_cimagf.c s_clog.c s_conj.c s_conjf.c s_cpow.c \ s_creal.c s_crealf.c s_csin.c s_csinh.c s_csqrt.c s_ctan.c \ s_ctanh.c s_fdim.c s_fmax.c s_fmaxf.c s_fmin.c s_fminf.c \ - s_cproj.c s_cprojf.c + s_cproj.c s_cprojf.c s_round.c s_roundf.c s_scalbln.c .if (${MACHINE_ARCH} == "vax") SRCS= ${NOIEEE_SRCS} ${NOIEEE_ARCH} ${PURE_SRCS} diff --git a/lib/libm/noieee_src/n_round.c b/lib/libm/noieee_src/n_round.c deleted file mode 100644 index f45badca52e..00000000000 --- a/lib/libm/noieee_src/n_round.c +++ /dev/null @@ -1,47 +0,0 @@ -/* $OpenBSD: n_round.c,v 1.1 2008/06/11 14:35:33 martynas Exp $ */ - -/*- - * Copyright (c) 2003, Steven G. Kargl - * 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 unmodified, 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 -round(double x) -{ - double t; - - if (x >= 0.0) { - t = floor(x); - if (t - x <= -0.5) - t += 1.0; - return (t); - } else { - t = floor(-x); - if (t + x <= -0.5) - t += 1.0; - return (-t); - } -} diff --git a/lib/libm/noieee_src/n_scalbln.c b/lib/libm/noieee_src/n_scalbln.c deleted file mode 100644 index c1fd86a4682..00000000000 --- a/lib/libm/noieee_src/n_scalbln.c +++ /dev/null @@ -1,31 +0,0 @@ -/* $OpenBSD: n_scalbln.c,v 1.1 2009/07/25 11:38:10 martynas Exp $ */ - -/* - * Written by Martynas Venckus. Public domain - */ - -#include <limits.h> -#include <math.h> - -double -scalbln(double x, long n) -{ - if (n < INT_MIN) - return scalbn(x, INT_MIN); - else if (n > INT_MAX) - return scalbn(x, INT_MAX); - else - return scalbn(x, (int)n); -} - -long double -scalblnl(long double x, long n) -{ - if (n < INT_MIN) - return scalbnl(x, INT_MIN); - else if (n > INT_MAX) - return scalbnl(x, INT_MAX); - else - return scalbnl(x, (int)n); -} - |