diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-04-11 18:01:04 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2019-04-11 18:20:33 +0200 |
commit | 74ab31b7f70bc34be5e5fb00a378166e72cd29bd (patch) | |
tree | 9850c5102168b9739b7a822a333bbc760364f756 /thirdparty/vhacd/inc | |
parent | 668439d16a5c30587ab77461fb3211306ad62587 (diff) |
vhacd: Fix -fpermissive build issue with MinGW
Fixes #27926.
Diffstat (limited to 'thirdparty/vhacd/inc')
-rw-r--r-- | thirdparty/vhacd/inc/btScalar.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/thirdparty/vhacd/inc/btScalar.h b/thirdparty/vhacd/inc/btScalar.h index 617fd7c44f..3999a71521 100644 --- a/thirdparty/vhacd/inc/btScalar.h +++ b/thirdparty/vhacd/inc/btScalar.h @@ -544,6 +544,29 @@ struct btTypedObject { }; // -- GODOT start -- +// Cherry-picked from Bullet 2.88 to fix GH-27926 +///align a pointer to the provided alignment, upwards +template <typename T> +T *btAlignPointer(T *unalignedPtr, size_t alignment) +{ + struct btConvertPointerSizeT + { + union { + T *ptr; + size_t integer; + }; + }; + btConvertPointerSizeT converter; + + const size_t bit_mask = ~(alignment - 1); + converter.ptr = unalignedPtr; + converter.integer += alignment - 1; + converter.integer &= bit_mask; + return converter.ptr; +} +// -- GODOT end -- + +// -- GODOT start -- }; // namespace VHACD // -- GODOT end -- |