1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-03 20:39:40 +00:00

Optimize NIF boolean vector reading

This commit is contained in:
Alexei Kotov 2025-02-07 04:55:06 +03:00
parent 1aa4ef029c
commit c1960635d2

View file

@ -228,13 +228,17 @@ namespace Nif
{
if (getVersion() < generateVersion(4, 1, 0, 0))
{
for (bool& value : std::span(dest, size))
value = get<int32_t>() != 0;
std::vector<int32_t> buf(size);
read(buf.data(), size);
for (size_t i = 0; i < size; ++i)
dest[i] = buf[i] != 0;
}
else
{
for (bool& value : std::span(dest, size))
value = get<int8_t>() != 0;
std::vector<int8_t> buf(size);
read(buf.data(), size);
for (size_t i = 0; i < size; ++i)
dest[i] = buf[i] != 0;
}
}