newlib-cygwin/newlib/libc/sys/sysvnecv70/fpx.c

71 lines
986 B
C
Raw Normal View History

2000-02-18 03:39:52 +08:00
#include <ieeefp.h>
#include <machine/registers.h>
fp_except fpsetmask (fp_except newmask)
2000-02-18 03:39:52 +08:00
{
fp_except oldmask;
v60_tkcw_type tkcw;
sysv60(0, 8, &tkcw);
oldmask = tkcw.fp_trap;
tkcw.fp_trap = newmask;
sysv60(0, 8, &tkcw);
return oldmask;
}
fp_except fpgetmask (void)
2000-02-18 03:39:52 +08:00
{
v60_tkcw_type tkcw;
sysv60(0, 8, &tkcw);
return tkcw.fp_trap;
}
fp_rnd fpgetround (void)
2000-02-18 03:39:52 +08:00
{
v60_tkcw_type tkcw;
sysv60(0, 8, &tkcw);
return tkcw.fp_rounding;
}
fp_rnd fpsetround (fp_rnd rnd)
2000-02-18 03:39:52 +08:00
{
fp_rnd oldrnd;
v60_tkcw_type tkcw;
sysv60(0, 8, &tkcw);
oldrnd = tkcw.fp_rounding;
tkcw.fp_rounding = rnd;
sysv60(0, 8, &tkcw);
return oldrnd;
}
fp_rdi fpgetroundtoi (void)
2000-02-18 03:39:52 +08:00
{
v60_tkcw_type tkcw;
sysv60(0, 8, &tkcw);
return tkcw.integer_rounding;
}
fp_rdi fpsetroundtoi (fp_rdi rnd)
2000-02-18 03:39:52 +08:00
{
fp_rdi oldrnd;
v60_tkcw_type tkcw;
sysv60(0, 8, &tkcw);
oldrnd = tkcw.integer_rounding;
tkcw.integer_rounding = rnd;
sysv60(0, 8, &tkcw);
return oldrnd;
}