home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_03_05 / 3n05054a < prev    next >
Text File  |  1992-03-10  |  790b  |  30 lines

  1. Listing 1
  2.  
  3.  
  4. /*****************************************************/
  5. /* clearfpu.c                                        */
  6. /*****************************************************/
  7.  
  8. void
  9. ClearFPU(void)
  10. /*****************************************************/
  11. /* -- Safely clear exception bits in the FPU.        */
  12. /* -- Ignore all FPU exceptions.                     */ 
  13. /* -- Call this routine following each call to       */
  14. /*    GetMessage() or PeekMessage().                 */
  15. /*****************************************************/
  16.     {
  17.     unsigned    wControl;
  18.  
  19.     /* Get the current control word. */
  20.     _asm fnstcw wControl;
  21.     _asm wait;
  22.  
  23.     /* Ignore all exceptions. */
  24.     wControl |= 0x007f;
  25.     _asm fnclex;
  26.     _asm fldcw  wControl;
  27.     }
  28.  
  29.  
  30.