Minor cleanup of breadth-first search functions

git-svn-id: https://svn.eduke32.com/eduke32@7476 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-04-06 06:37:32 +00:00 committed by Christoph Oelckers
parent 146fa7e79e
commit 83999ee6e4
2 changed files with 9 additions and 11 deletions

View file

@ -1141,8 +1141,8 @@ static FORCE_INLINE void rotatesprite_win(int32_t sx, int32_t sy, int32_t z, int
rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, 0, windowxy1.x,windowxy1.y,windowxy2.x,windowxy2.y);
}
void bfirst_search_init(int16_t *list, uint8_t *bitmap, int32_t *eltnumptr, int32_t maxnum, int16_t firstelt);
void bfirst_search_try(int16_t *list, uint8_t *bitmap, int32_t *eltnumptr, int16_t elt);
void bfirst_search_init(int16_t * const list, uint8_t * const bitmap, int32_t * const eltnumptr, int const maxelts, int const firstelt);
void bfirst_search_try(int16_t * const list, uint8_t * const bitmap, int32_t * const eltnumptr, int const elt);
void getzrange(const vec3_t *pos, int16_t sectnum, int32_t *ceilz, int32_t *ceilhit, int32_t *florz,
int32_t *florhit, int32_t walldist, uint32_t cliptype) ATTRIBUTE((nonnull(1,3,4,5,6)));

View file

@ -10939,25 +10939,23 @@ int32_t lastwall(int16_t point)
}
// breadth-first search helpers
void bfirst_search_init(int16_t *list, uint8_t *bitmap, int32_t *eltnumptr, int32_t maxnum, int16_t firstelt)
void bfirst_search_init(int16_t * const list, uint8_t * const bitmap, int32_t * const eltnumptr, int const maxelts, int const firstelt)
{
Bmemset(bitmap, 0, (maxnum+7)>>3);
Bmemset(bitmap, 0, (maxelts+7)>>3);
list[0] = firstelt;
bitmap[firstelt>>3] |= (1<<(firstelt&7));
bitmap_set(bitmap, firstelt);
*eltnumptr = 1;
}
void bfirst_search_try(int16_t *list, uint8_t *bitmap, int32_t *eltnumptr, int16_t elt)
void bfirst_search_try(int16_t * const list, uint8_t * const bitmap, int32_t * const eltnumptr, int const elt)
{
if (elt < 0)
return;
if ((bitmap[elt>>3]&(1<<(elt&7)))==0)
else if (bitmap_test(bitmap, elt)==0)
{
bitmap[elt>>3] |= (1<<(elt&7));
list[*eltnumptr] = elt;
(*eltnumptr)++;
bitmap_set(bitmap, elt);
list[(*eltnumptr)++] = elt;
}
}