NetBSD/lib/libc/arch/ns32k/gen/fpgetsticky.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
744 B
C

/* $NetBSD: fpgetsticky.c,v 1.4 2002/01/13 21:45:46 thorpej Exp $ */
/*
* Written by J.T. Conklin, Apr 11, 1995
* Public domain.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpgetsticky.c,v 1.4 2002/01/13 21:45:46 thorpej Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <ieeefp.h>
#include <machine/cpufunc.h>
#include <machine/fpu.h>
#ifdef __weak_alias
__weak_alias(fpgetsticky,_fpgetsticky)
#endif
fp_except
fpgetsticky()
{
fp_except x;
fp_except ebits = FPC_IEN | FPC_OVE | FPC_IVE | FPC_DZE | FPC_UNDE;
sfsr(x);
/* Map FPC_UF to soft underflow enable */
if (x & FPC_UF)
x |= FPC_UNDE << 1;
else
x &= ~(FPC_UNDE << 1);
x >>= 1;
return x & ebits;
}