diff options
author | David Snopek <dsnopek@gmail.com> | 2024-01-19 12:15:55 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-19 12:15:55 -0600 |
commit | 0145e900f335fa3691564bb51080125b51c38c52 (patch) | |
tree | 4ba30f6db8483c4c6e71229c015896ce8ec17c8f /include/godot_cpp/templates/safe_refcount.hpp | |
parent | 6c04514039a34c646c7e30aa25f48fdd04e13daf (diff) | |
parent | 59a5a8b104e3fcf63c13732ffbb12d8c577a26ce (diff) | |
download | redot-cpp-0145e900f335fa3691564bb51080125b51c38c52.tar.gz |
Merge pull request #1357 from bruvzg/cpp_64
Switch to 64-bit ints.
Diffstat (limited to 'include/godot_cpp/templates/safe_refcount.hpp')
-rw-r--r-- | include/godot_cpp/templates/safe_refcount.hpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/godot_cpp/templates/safe_refcount.hpp b/include/godot_cpp/templates/safe_refcount.hpp index f865041..519bbf7 100644 --- a/include/godot_cpp/templates/safe_refcount.hpp +++ b/include/godot_cpp/templates/safe_refcount.hpp @@ -48,6 +48,15 @@ namespace godot { // value and, as an important benefit, you can be sure the value is properly synchronized // even with threads that are already running. +// These are used in very specific areas of the engine where it's critical that these guarantees are held +#define SAFE_NUMERIC_TYPE_PUN_GUARANTEES(m_type) \ + static_assert(sizeof(SafeNumeric<m_type>) == sizeof(m_type)); \ + static_assert(alignof(SafeNumeric<m_type>) == alignof(m_type)); \ + static_assert(std::is_trivially_destructible<std::atomic<m_type>>::value); +#define SAFE_FLAG_TYPE_PUN_GUARANTEES \ + static_assert(sizeof(SafeFlag) == sizeof(bool)); \ + static_assert(alignof(SafeFlag) == alignof(bool)); + template <class T> class SafeNumeric { std::atomic<T> value; |