Listing 1


/*****************************************************/
/* clearfpu.c                                        */
/*****************************************************/

void
ClearFPU(void)
/*****************************************************/
/* -- Safely clear exception bits in the FPU.        */
/* -- Ignore all FPU exceptions.                     */ 
/* -- Call this routine following each call to       */
/*    GetMessage() or PeekMessage().                 */
/*****************************************************/
    {
    unsigned    wControl;

    /* Get the current control word. */
    _asm fnstcw wControl;
    _asm wait;

    /* Ignore all exceptions. */
    wControl |= 0x007f;
    _asm fnclex;
    _asm fldcw  wControl;
    }


