fastlib.h 705 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #ifndef CRYINCLUDE_EDITOR_UTIL_FASTLIB_H
  9. #define CRYINCLUDE_EDITOR_UTIL_FASTLIB_H
  10. #pragma once
  11. __forceinline int RoundFloatToInt(float fValue)
  12. {
  13. return (int)(fValue + 0.5f);
  14. }
  15. __forceinline int __stdcall FloatToIntRet(float fValue)
  16. {
  17. return (int)(fValue + 0.5f);
  18. }
  19. __forceinline int ftoi(float fValue)
  20. {
  21. return (int)(fValue);
  22. }
  23. __forceinline unsigned int __stdcall ifloor(float fValue)
  24. {
  25. return ftoi(floor(fValue));
  26. }
  27. #endif // CRYINCLUDE_EDITOR_UTIL_FASTLIB_H