Minor improvement when building with C++17 compiler
This commit is contained in:
Родитель
81f53f04bf
Коммит
ca1410cc8d
|
@ -261,16 +261,10 @@ public:
|
||||||
if (index == uint32_t(-1))
|
if (index == uint32_t(-1))
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
#pragma warning( suppress : 4127 )
|
constexpr uint32_t maxIndex = (sizeof(index_t) == 2) ? UINT16_MAX : UINT32_MAX;
|
||||||
if (sizeof(index_t) == 2 && (index >= 0xFFFF))
|
if (index >= maxIndex)
|
||||||
{
|
{
|
||||||
// Too many indices for 16-bit IB!
|
// Too many indices for IB!
|
||||||
return E_FAIL;
|
|
||||||
}
|
|
||||||
#pragma warning( suppress : 4127 )
|
|
||||||
else if (sizeof(index_t) == 4 && (index >= 0xFFFFFFFF))
|
|
||||||
{
|
|
||||||
// Too many indices for 32-bit IB!
|
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -611,8 +605,12 @@ public:
|
||||||
vertices.resize(numVertices);
|
vertices.resize(numVertices);
|
||||||
vboFile.read(reinterpret_cast<char*>(vertices.data()), sizeof(Vertex) * numVertices);
|
vboFile.read(reinterpret_cast<char*>(vertices.data()), sizeof(Vertex) * numVertices);
|
||||||
|
|
||||||
|
#if (__cplusplus >= 201703L)
|
||||||
|
if constexpr (sizeof(index_t) == 2)
|
||||||
|
#else
|
||||||
#pragma warning( suppress : 4127 )
|
#pragma warning( suppress : 4127 )
|
||||||
if (sizeof(index_t) == 2)
|
if (sizeof(index_t) == 2)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
indices.resize(numIndices);
|
indices.resize(numIndices);
|
||||||
vboFile.read(reinterpret_cast<char*>(indices.data()), sizeof(uint16_t) * numIndices);
|
vboFile.read(reinterpret_cast<char*>(indices.data()), sizeof(uint16_t) * numIndices);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче