Fix swapbufreverse(), adding precondition of count >= 4.

Also, in premap.c:G_CacheMapData(), comment out what was supposedly
intended as a debugging message ("percentage ...").

git-svn-id: https://svn.eduke32.com/eduke32@5009 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2015-02-17 16:23:04 +00:00
parent ba84b3c4b6
commit 4f54c7cf88
2 changed files with 7 additions and 3 deletions

View file

@ -248,6 +248,8 @@ static inline int32_t krecipasm(int32_t i)
static inline void swapbufreverse(void *s, void *d, int32_t c)
{
uint8_t *src = (uint8_t *)s, *dst = (uint8_t *)d;
Bassert(c >= 4);
do
{
swapchar(dst, src);
@ -255,8 +257,10 @@ static inline void swapbufreverse(void *s, void *d, int32_t c)
swapchar(dst + 2, src - 2);
swapchar(dst + 3, src - 3);
dst += 4, src -= 4;
} while (--c > 4);
while (c--) swapchar(dst++, src--);
} while ((c -= 4) > 4);
while (c--)
swapchar(dst++, src--);
}
#ifdef __cplusplus

View file

@ -564,7 +564,7 @@ void G_CacheMapData(void)
lpc++;
}
OSD_Printf("percentage %d lpc %d\n", percentage, lpc);
// OSD_Printf("percentage %d lpc %d\n", percentage, lpc);
}
tc = totalclock;