2000-02-18 03:39:52 +08:00
|
|
|
#include <ieeefp.h>
|
|
|
|
#include <machine/registers.h>
|
|
|
|
|
|
|
|
|
2017-12-04 11:43:30 +08:00
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-12-04 11:00:43 +08:00
|
|
|
fp_except fpgetmask (void)
|
2000-02-18 03:39:52 +08:00
|
|
|
{
|
|
|
|
v60_tkcw_type tkcw;
|
|
|
|
sysv60(0, 8, &tkcw);
|
|
|
|
return tkcw.fp_trap;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-12-04 11:00:43 +08:00
|
|
|
fp_rnd fpgetround (void)
|
2000-02-18 03:39:52 +08:00
|
|
|
{
|
|
|
|
v60_tkcw_type tkcw;
|
|
|
|
sysv60(0, 8, &tkcw);
|
|
|
|
return tkcw.fp_rounding;
|
|
|
|
}
|
|
|
|
|
2017-12-04 11:43:30 +08:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-12-04 11:00:43 +08:00
|
|
|
fp_rdi fpgetroundtoi (void)
|
2000-02-18 03:39:52 +08:00
|
|
|
{
|
|
|
|
v60_tkcw_type tkcw;
|
|
|
|
sysv60(0, 8, &tkcw);
|
|
|
|
return tkcw.integer_rounding;
|
|
|
|
}
|
|
|
|
|
2017-12-04 11:43:30 +08:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|