terrain: change how initial all not in view patchs are send

This commit is contained in:
UbitUmarov
2022-04-02 01:41:08 +01:00
parent bea0f4d18b
commit 4ebc639669
2 changed files with 76 additions and 74 deletions

View File

@@ -261,18 +261,31 @@ namespace OpenSim.Framework
{
if (startBitIndex < 0 || startBitIndex >= m_nbits)
return -1;
int indexh = startBitIndex >> VectorNumberBitsLog2;
for (; indexh < m_data.Length; ++indexh)
int j = startBitIndex & (VectorNumberBits - 1);
int cur = m_data[indexh];
if (cur != 0)
{
int cur = m_data[indexh];
if (cur == 0)
continue;
for (int j = 0; j < VectorNumberBits; ++j)
for (; j < VectorNumberBits; ++j)
{
if ((cur & (1 << j)) != 0)
return (indexh << VectorNumberBitsLog2) | j;
}
}
while (++indexh < m_data.Length)
{
cur = m_data[indexh];
if (cur != 0)
{
for (j = 0; j < VectorNumberBits; ++j)
{
if ((cur & (1 << j)) != 0)
return (indexh << VectorNumberBitsLog2) | j;
}
}
}
return -1;
}
@@ -280,15 +293,15 @@ namespace OpenSim.Framework
{
if (m_ntainted <= 0 || startBitIndex < 0 || startBitIndex >= m_nbits)
return -1;
int indexh = startBitIndex >> VectorNumberBitsLog2;
int j = startBitIndex & (VectorNumberBits - 1);
lock (m_mainlock)
{
for (; indexh < m_data.Length; ++indexh)
int cur = m_data[indexh];
if (cur != 0)
{
int cur = m_data[indexh];
if (cur == 0)
continue;
for (int j = 0; j < VectorNumberBits; ++j)
for (; j < VectorNumberBits; ++j)
{
int mask = (1 << j);
if ((cur & mask) != 0)
@@ -299,6 +312,24 @@ namespace OpenSim.Framework
}
}
}
while (++indexh < m_data.Length)
{
cur = m_data[indexh];
if (cur != 0)
{
for (j = 0; j < VectorNumberBits; ++j)
{
int mask = (1 << j);
if ((cur & mask) != 0)
{
m_data[indexh] ^= mask;
--m_ntainted;
return (indexh << VectorNumberBitsLog2) | j;
}
}
}
}
}
return -1;
}