mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2024-11-10 02:31:48 +00:00
Merge pull request #364 from manas-kulkarni/master
Make C++20 features optional
This commit is contained in:
commit
540544f63a
@ -2624,10 +2624,18 @@ VMA_CALL_PRE void VMA_CALL_POST vmaFreeStatsString(
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#if !defined(VMA_CPP20)
|
||||||
|
#if __cplusplus >= 202002L || _MSVC_LANG >= 202002L // C++20
|
||||||
|
#define VMA_CPP20 1
|
||||||
|
#else
|
||||||
|
#define VMA_CPP20 0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#include <intrin.h> // For functions like __popcnt, _BitScanForward etc.
|
#include <intrin.h> // For functions like __popcnt, _BitScanForward etc.
|
||||||
#endif
|
#endif
|
||||||
#if __cplusplus >= 202002L || _MSVC_LANG >= 202002L // C++20
|
#if VMA_CPP20
|
||||||
#include <bit> // For std::popcount
|
#include <bit> // For std::popcount
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -3263,7 +3271,7 @@ But you need to check in runtime whether user's CPU supports these, as some old
|
|||||||
*/
|
*/
|
||||||
static inline uint32_t VmaCountBitsSet(uint32_t v)
|
static inline uint32_t VmaCountBitsSet(uint32_t v)
|
||||||
{
|
{
|
||||||
#if __cplusplus >= 202002L || _MSVC_LANG >= 202002L // C++20
|
#if VMA_CPP20
|
||||||
return std::popcount(v);
|
return std::popcount(v);
|
||||||
#else
|
#else
|
||||||
uint32_t c = v - ((v >> 1) & 0x55555555);
|
uint32_t c = v - ((v >> 1) & 0x55555555);
|
||||||
|
Loading…
Reference in New Issue
Block a user