mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Branchless sectorofwall_internal()
git-svn-id: https://svn.eduke32.com/eduke32@6794 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
aba97eb6a9
commit
f3843a9a3a
2 changed files with 16 additions and 17 deletions
|
@ -1223,8 +1223,8 @@ int clipshape_idx_for_sprite(uspritetype const * const curspr, int curidx);
|
||||||
|
|
||||||
void alignceilslope(int16_t dasect, int32_t x, int32_t y, int32_t z);
|
void alignceilslope(int16_t dasect, int32_t x, int32_t y, int32_t z);
|
||||||
void alignflorslope(int16_t dasect, int32_t x, int32_t y, int32_t z);
|
void alignflorslope(int16_t dasect, int32_t x, int32_t y, int32_t z);
|
||||||
int32_t sectorofwall(int16_t theline);
|
int32_t sectorofwall(int16_t wallNum);
|
||||||
int32_t sectorofwall_noquick(int16_t theline);
|
int32_t sectorofwall_noquick(int16_t wallNum);
|
||||||
int32_t loopnumofsector(int16_t sectnum, int16_t wallnum);
|
int32_t loopnumofsector(int16_t sectnum, int16_t wallnum);
|
||||||
void setslope(int32_t sectnum, int32_t cf, int16_t slope);
|
void setslope(int32_t sectnum, int32_t cf, int16_t slope);
|
||||||
|
|
||||||
|
|
|
@ -12473,39 +12473,38 @@ void completemirror(void)
|
||||||
//
|
//
|
||||||
// sectorofwall
|
// sectorofwall
|
||||||
//
|
//
|
||||||
static int32_t sectorofwall_internal(int16_t theline)
|
static int32_t sectorofwall_internal(int16_t wallNum)
|
||||||
{
|
{
|
||||||
int32_t gap = numsectors>>1, i = gap;
|
native_t gap = numsectors>>1, sectNum = gap;
|
||||||
|
|
||||||
while (gap > 1)
|
while (gap > 1)
|
||||||
{
|
{
|
||||||
gap >>= 1;
|
gap >>= 1;
|
||||||
if (sector[i].wallptr < theline) i += gap; else i -= gap;
|
native_t const n = !!(sector[sectNum].wallptr < wallNum);
|
||||||
|
sectNum += (n ^ (n - 1)) * gap;
|
||||||
}
|
}
|
||||||
while (sector[i].wallptr > theline) i--;
|
while (sector[sectNum].wallptr > wallNum) sectNum--;
|
||||||
while (sector[i].wallptr+sector[i].wallnum <= theline) i++;
|
while (sector[sectNum].wallptr + sector[sectNum].wallnum <= wallNum) sectNum++;
|
||||||
|
|
||||||
return i;
|
return sectNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t sectorofwall(int16_t theline)
|
int32_t sectorofwall(int16_t wallNum)
|
||||||
{
|
{
|
||||||
if ((unsigned)theline >= (unsigned)numwalls)
|
if (EDUKE32_PREDICT_FALSE((unsigned)wallNum >= (unsigned)numwalls))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
int i = wall[theline].nextwall;
|
native_t const w = wall[wallNum].nextwall;
|
||||||
if ((unsigned)i < MAXWALLS)
|
|
||||||
return wall[i].nextsector;
|
|
||||||
|
|
||||||
return sectorofwall_internal(theline);
|
return ((unsigned)w < MAXWALLS) ? wall[w].nextsector : sectorofwall_internal(wallNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t sectorofwall_noquick(int16_t theline)
|
int32_t sectorofwall_noquick(int16_t wallNum)
|
||||||
{
|
{
|
||||||
if ((unsigned)theline >= (unsigned)numwalls)
|
if (EDUKE32_PREDICT_FALSE((unsigned) wallNum >= (unsigned) numwalls))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return sectorofwall_internal(theline);
|
return sectorofwall_internal(wallNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue