NetBSD/lib/libc/arch/ns32k/gen/fpsetround.c
thorpej 5d3e829423 Add internal names for fp{get,set}{mask,round,sticky}(), and
externally-visible weak aliases for the internal names.
2002-01-13 21:45:39 +00:00

39 lines
647 B
C

/* $NetBSD: fpsetround.c,v 1.4 2002/01/13 21:45:47 thorpej Exp $ */
/*
* Written by J.T. Conklin, Apr 28, 1995
* Public domain.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpsetround.c,v 1.4 2002/01/13 21:45:47 thorpej Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <ieeefp.h>
#include <machine/cpufunc.h>
#ifdef __weak_alias
__weak_alias(fpsetround,_fpsetround)
#endif
fp_rnd
fpsetround(rnd_dir)
fp_rnd rnd_dir;
{
fp_rnd old;
fp_rnd new;
sfsr(old);
new = old;
new &= ~(0x03 << 7);
new |= ((rnd_dir & 0x03) << 7);
lfsr(new);
return (old >> 7) & 0x03;
}