FPFlushDenormals.h 852 B

12345678910111213141516171819202122232425262728293031
  1. // SPDX-FileCopyrightText: 2021 Jorrit Rouwe
  2. // SPDX-License-Identifier: MIT
  3. #pragma once
  4. #include <Core/FPControlWord.h>
  5. namespace JPH {
  6. #if defined(JPH_USE_SSE)
  7. /// Helper class that needs to be put on the stack to enable flushing denormals to zero
  8. /// This can make floating point operations much faster when working with very small numbers
  9. class FPFlushDenormals : public FPControlWord<_MM_FLUSH_ZERO_ON, _MM_FLUSH_ZERO_MASK> { };
  10. #elif defined(JPH_USE_NEON)
  11. /// Flush denormals to zero bit
  12. static constexpr uint64 FP_FZ = 1 << 24;
  13. /// Helper class that needs to be put on the stack to enable flushing denormals to zero
  14. /// This can make floating point operations much faster when working with very small numbers
  15. class FPFlushDenormals : public FPControlWord<FP_FZ, FP_FZ> { };
  16. #else
  17. #error Unsupported CPU architecture
  18. #endif
  19. } // JPH