Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
FPException.h
Go to the documentation of this file.
1// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
2// SPDX-FileCopyrightText: 2021 Jorrit Rouwe
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
8
10
11#ifdef JPH_FLOATING_POINT_EXCEPTIONS_ENABLED
12
13#if defined(JPH_CPU_WASM)
14
15// Not supported
16class FPExceptionsEnable { };
20
21#elif defined(JPH_USE_SSE)
22
24class FPExceptionsEnable : public FPControlWord<0, _MM_MASK_DIV_ZERO | _MM_MASK_INVALID | _MM_MASK_OVERFLOW> { };
25
27class FPExceptionDisableInvalid : public FPControlWord<_MM_MASK_INVALID, _MM_MASK_INVALID> { };
28
30class FPExceptionDisableDivByZero : public FPControlWord<_MM_MASK_DIV_ZERO, _MM_MASK_DIV_ZERO> { };
31
33class FPExceptionDisableOverflow : public FPControlWord<_MM_MASK_OVERFLOW, _MM_MASK_OVERFLOW> { };
34
35#elif defined(JPH_CPU_ARM) && defined(JPH_COMPILER_MSVC)
36
38class FPExceptionsEnable : public FPControlWord<0, _EM_INVALID | _EM_ZERODIVIDE | _EM_OVERFLOW> { };
39
41class FPExceptionDisableInvalid : public FPControlWord<_EM_INVALID, _EM_INVALID> { };
42
44class FPExceptionDisableDivByZero : public FPControlWord<_EM_ZERODIVIDE, _EM_ZERODIVIDE> { };
45
47class FPExceptionDisableOverflow : public FPControlWord<_EM_OVERFLOW, _EM_OVERFLOW> { };
48
49#elif defined(JPH_CPU_ARM)
50
52static constexpr uint64 FP_IOE = 1 << 8;
53
55static constexpr uint64 FP_DZE = 1 << 9;
56
58static constexpr uint64 FP_OFE = 1 << 10;
59
61class FPExceptionsEnable : public FPControlWord<FP_IOE | FP_DZE | FP_OFE, FP_IOE | FP_DZE | FP_OFE> { };
62
64class FPExceptionDisableInvalid : public FPControlWord<0, FP_IOE> { };
65
67class FPExceptionDisableDivByZero : public FPControlWord<0, FP_DZE> { };
68
70class FPExceptionDisableOverflow : public FPControlWord<0, FP_OFE> { };
71
72#elif defined(JPH_CPU_RISCV)
73
74#error "RISC-V only implements manually checking if exceptions occurred by reading the fcsr register. It doesn't generate exceptions. JPH_FLOATING_POINT_EXCEPTIONS_ENABLED must be disabled."
75
76#elif defined(JPH_CPU_PPC)
77
78#error PowerPC floating point exception handling to be implemented. JPH_FLOATING_POINT_EXCEPTIONS_ENABLED must be disabled.
79
80#else
81
82#error Unsupported CPU architecture
83
84#endif
85
86#else
87
93
94#endif
95
std::uint64_t uint64
Definition Core.h:485
#define JPH_NAMESPACE_END
Definition Core.h:414
#define JPH_NAMESPACE_BEGIN
Definition Core.h:408
Definition FPException.h:91
Definition FPException.h:90
Definition FPException.h:92
Dummy implementations.
Definition FPException.h:89