Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
650 B

  1. /******************************************************************************
  2. * FTOL.h *
  3. *-------------*
  4. *
  5. *------------------------------------------------------------------------------
  6. * Copyright (C) 2000 Microsoft Corporation Date: 12/04/00
  7. * All Rights Reserved
  8. *
  9. ********************************************************************* mplumpe ***/
  10. #pragma once
  11. // Do a floating to integer conversion quickly
  12. // NOTE : FTOL rounds, while (int) truncates!!!
  13. #ifdef _M_IX86
  14. #define FTOL(f) fast_ftol(f)
  15. __inline int fast_ftol (double f)
  16. {
  17. int i;
  18. __asm FLD f
  19. __asm FISTP i
  20. return i;
  21. }
  22. #else
  23. #define FTOL(f) (int) (f)
  24. #endif