File : rounding.adb
with System.Machine_Code;
use System.Machine_Code;
package body Rounding is
procedure Load_Control_Word(W: in Uns16) is
begin
--- clear exception flags after handling pending unmaked exceptions
Asm("fclex",Volatile => True);
--- load control word into FPU
Asm("fldcw %0",Inputs => Uns16'Asm_Input("g",W), Volatile => True);
end Load_Control_Word;
procedure Relax_Checks is
begin
Load_Control_Word(Relaxed);
end Relax_Checks;
procedure Restore_Checks is
begin
Load_Control_Word(Strict);
end Restore_Checks;
end Rounding;