1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-18 02:52:10 +01:00

[dxgi] Replace MSVC _countof macro with std::size (#231)

* [dxgi] Replace MSVC _countof macro with std::size

pro: crosscompiler
con: may not work for older clang/gcc/...

http://en.cppreference.com/w/cpp/iterator/size
For example `Run this code` mode produces errors for GCC-5.2(C++17) and clang-3.8(C++17). Local GCC-7.3 and clang-7 versions are ok. 
Not tested w/ MinGW64.

*  [dxgi] Replace MSVC _countof macro with std::size
This commit is contained in:
pchome 2018-04-02 19:49:03 +03:00 committed by Philip Rebohle
parent 0582e265f0
commit e9c7dcfc76
2 changed files with 2 additions and 2 deletions

View File

@ -125,7 +125,7 @@ namespace dxvk {
}
std::memset(pDesc->Description, 0, sizeof(pDesc->Description));
std::mbstowcs(pDesc->Description, deviceProp.deviceName, _countof(pDesc->Description) - 1);
std::mbstowcs(pDesc->Description, deviceProp.deviceName, std::size(pDesc->Description) - 1);
VkDeviceSize deviceMemory = 0;
VkDeviceSize sharedMemory = 0;

View File

@ -144,7 +144,7 @@ namespace dxvk {
}
std::memset(pDesc->DeviceName, 0, sizeof(pDesc->DeviceName));
std::mbstowcs(pDesc->DeviceName, monInfo.szDevice, _countof(pDesc->DeviceName) - 1);
std::mbstowcs(pDesc->DeviceName, monInfo.szDevice, std::size(pDesc->DeviceName) - 1);
pDesc->DesktopCoordinates = monInfo.rcMonitor;
pDesc->AttachedToDesktop = 1;