mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 00:49:19 +02:00
Replace count_trailing_zeros with std::countr_zero
This commit is contained in:
@@ -982,11 +982,11 @@ opengl_texture::create( bool const Static ) {
|
|||||||
if (Global.gfx_usegles)
|
if (Global.gfx_usegles)
|
||||||
{
|
{
|
||||||
if( target == GL_TEXTURE_2D )
|
if( target == GL_TEXTURE_2D )
|
||||||
glTexStorage2D(target, count_trailing_zeros(std::max(data_width, data_height)) + 1, data_format, data_width, data_height);
|
glTexStorage2D(target, std::countr_zero(static_cast<unsigned int>(std::max(data_width, data_height))) + 1, data_format, data_width, data_height);
|
||||||
else if( target == GL_TEXTURE_2D_MULTISAMPLE )
|
else if( target == GL_TEXTURE_2D_MULTISAMPLE )
|
||||||
glTexStorage2DMultisample( target, samples, data_format, data_width, data_height, GL_FALSE );
|
glTexStorage2DMultisample( target, samples, data_format, data_width, data_height, GL_FALSE );
|
||||||
else if( target == GL_TEXTURE_2D_ARRAY )
|
else if( target == GL_TEXTURE_2D_ARRAY )
|
||||||
glTexStorage3D( target, count_trailing_zeros( std::max( data_width, data_height ) ) + 1, data_format, data_width, data_height, layers );
|
glTexStorage3D(target, std::countr_zero(static_cast<unsigned int>(std::max(data_width, data_height))) + 1, data_format, data_width, data_height, layers);
|
||||||
else if( target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY )
|
else if( target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY )
|
||||||
glTexStorage3DMultisample( target, samples, data_format, data_width, data_height, layers, GL_FALSE );
|
glTexStorage3DMultisample( target, samples, data_format, data_width, data_height, layers, GL_FALSE );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -457,14 +457,4 @@ std::string deserialize_random_set(cParser &Input, char const *Break)
|
|||||||
// shouldn't ever get here but, eh
|
// shouldn't ever get here but, eh
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int count_trailing_zeros(uint32_t val)
|
|
||||||
{
|
|
||||||
int r = 0;
|
|
||||||
|
|
||||||
for (uint32_t shift = 1; !(val & shift); shift <<= 1)
|
|
||||||
r++;
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
@@ -380,8 +380,6 @@ glm::dvec3 LoadPoint(class cParser &Input);
|
|||||||
// extracts a group of tokens from provided data stream
|
// extracts a group of tokens from provided data stream
|
||||||
std::string deserialize_random_set(cParser &Input, char const *Break = "\n\r\t ;");
|
std::string deserialize_random_set(cParser &Input, char const *Break = "\n\r\t ;");
|
||||||
|
|
||||||
int count_trailing_zeros(uint32_t val);
|
|
||||||
|
|
||||||
// extracts a group of <key, value> pairs from provided data stream
|
// extracts a group of <key, value> pairs from provided data stream
|
||||||
// NOTE: expects no more than single pair per line
|
// NOTE: expects no more than single pair per line
|
||||||
template <typename MapType_> void deserialize_map(MapType_ &Map, cParser &Input)
|
template <typename MapType_> void deserialize_map(MapType_ &Map, cParser &Input)
|
||||||
|
|||||||
Reference in New Issue
Block a user