Introduce GAMEARRAY_SIZE_MASK.

git-svn-id: https://svn.eduke32.com/eduke32@6392 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2017-07-28 08:27:31 +00:00
parent b01b25bc93
commit 6e7daf6d1b
3 changed files with 8 additions and 8 deletions

View file

@ -4408,7 +4408,7 @@ finish_qsprintf:
numBytes = Gv_GetArrayAllocSize(arrayNum);
switch (aGameArrays[arrayNum].flags & GAMEARRAY_TYPE_MASK)
switch (aGameArrays[arrayNum].flags & GAMEARRAY_SIZE_MASK)
{
case 0:
#ifdef BITNESS64
@ -4462,7 +4462,7 @@ finish_qsprintf:
continue;
}
switch (aGameArrays[arrayNum].flags & GAMEARRAY_TYPE_MASK)
switch (aGameArrays[arrayNum].flags & GAMEARRAY_SIZE_MASK)
{
case 0:
#ifdef BITNESS64
@ -4563,7 +4563,7 @@ finish_qsprintf:
int const destInc = 1 << (int)!!(EDUKE32_PREDICT_FALSE(aGameArrays[destArray].flags & GAMEARRAY_STRIDE2));
// matching array types and no STRIDE2 flag
if ((aGameArrays[srcArray].flags & GAMEARRAY_TYPE_MASK) == (aGameArrays[destArray].flags & GAMEARRAY_TYPE_MASK) && (srcInc & destInc) == 1)
if ((aGameArrays[srcArray].flags & GAMEARRAY_SIZE_MASK) == (aGameArrays[destArray].flags & GAMEARRAY_SIZE_MASK) && (srcInc & destInc) == 1)
{
Bmemcpy(aGameArrays[destArray].pValues + destArrayIndex, aGameArrays[srcArray].pValues + srcArrayIndex,
numElements * Gv_GetArrayElementSize(srcArray));

View file

@ -382,13 +382,11 @@ unsigned __fastcall Gv_GetArrayElementSize(int const arrayIdx)
{
int typeSize = 0;
switch (aGameArrays[arrayIdx].flags & GAMEARRAY_TYPE_MASK)
switch (aGameArrays[arrayIdx].flags & GAMEARRAY_SIZE_MASK)
{
case 0: typeSize = sizeof(uintptr_t); break;
case GAMEARRAY_INT8:
case GAMEARRAY_UINT8: typeSize = sizeof(uint8_t); break;
case GAMEARRAY_INT16:
case GAMEARRAY_UINT16: typeSize = sizeof(uint16_t); break;
case GAMEARRAY_INT8: typeSize = sizeof(uint8_t); break;
case GAMEARRAY_INT16: typeSize = sizeof(uint16_t); break;
}
return typeSize;
@ -602,6 +600,7 @@ int __fastcall Gv_GetArrayValue(int const id, int index)
switch (aGameArrays[id].flags & GAMEARRAY_TYPE_MASK)
{
case 0: returnValue = (aGameArrays[id].pValues)[index]; break;
case GAMEARRAY_INT16: returnValue = ((int16_t *)aGameArrays[id].pValues)[index]; break;
case GAMEARRAY_INT8: returnValue = ((int8_t *)aGameArrays[id].pValues)[index]; break;

View file

@ -74,6 +74,7 @@ enum GamearrayFlags_t
GAMEARRAY_BITMAP = 0x00100000,
GAMEARRAY_WARN = 0x00200000,
GAMEARRAY_SIZE_MASK = GAMEARRAY_INT8 | GAMEARRAY_INT16 | GAMEARRAY_BITMAP,
GAMEARRAY_TYPE_MASK = GAMEARRAY_UNSIGNED | GAMEARRAY_INT8 | GAMEARRAY_INT16 | GAMEARRAY_BITMAP,
};