mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
w_wad for lumpnums: Use bitwise and instead of addition
Makes the mathematical logic of what's being done clearer
This commit is contained in:
parent
1517ba4d89
commit
a01300cd54
1 changed files with 6 additions and 6 deletions
|
|
@ -1397,7 +1397,7 @@ lumpnum_t W_CheckNumForName(const char *name)
|
|||
lumpnumcacheindex = (lumpnumcacheindex + 1) & (LUMPNUMCACHESIZE - 1);
|
||||
memset(lumpnumcache[lumpnumcacheindex].lumpname, '\0', LUMPNUMCACHENAME);
|
||||
strncpy(lumpnumcache[lumpnumcacheindex].lumpname, name, 8);
|
||||
lumpnumcache[lumpnumcacheindex].lumpnum = (i << 16) + check;
|
||||
lumpnumcache[lumpnumcacheindex].lumpnum = (i << 16) | check;
|
||||
lumpnumcache[lumpnumcacheindex].lumphash = hash;
|
||||
|
||||
return lumpnumcache[lumpnumcacheindex].lumpnum;
|
||||
|
|
@ -1454,11 +1454,11 @@ lumpnum_t W_CheckNumForLongName(const char *name)
|
|||
lumpnumcacheindex = (lumpnumcacheindex + 1) & (LUMPNUMCACHESIZE - 1);
|
||||
memset(lumpnumcache[lumpnumcacheindex].lumpname, '\0', LUMPNUMCACHENAME);
|
||||
strlcpy(lumpnumcache[lumpnumcacheindex].lumpname, name, LUMPNUMCACHENAME);
|
||||
lumpnumcache[lumpnumcacheindex].lumpnum = (i << 16) + check;
|
||||
lumpnumcache[lumpnumcacheindex].lumpnum = (i << 16) | check;
|
||||
lumpnumcache[lumpnumcacheindex].lumphash = hash;
|
||||
}
|
||||
|
||||
return (i << 16) + check;
|
||||
return (i << 16) | check;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1505,11 +1505,11 @@ lumpnum_t W_CheckNumForMap(const char *name, boolean checktofirst)
|
|||
lumpnumcacheindex = (lumpnumcacheindex + 1) & (LUMPNUMCACHESIZE - 1);
|
||||
memset(lumpnumcache[lumpnumcacheindex].lumpname, '\0', LUMPNUMCACHENAME);
|
||||
strlcpy(lumpnumcache[lumpnumcacheindex].lumpname, name, LUMPNUMCACHENAME);
|
||||
lumpnumcache[lumpnumcacheindex].lumpnum = (i << 16) + check;
|
||||
lumpnumcache[lumpnumcacheindex].lumpnum = (i << 16) | check;
|
||||
lumpnumcache[lumpnumcacheindex].lumphash = hash;
|
||||
}
|
||||
|
||||
return (i << 16) + check;
|
||||
return (i << 16) | check;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1608,7 +1608,7 @@ lumpnum_t W_CheckNumForNameInFolder(const char *lump, const char *folder)
|
|||
check = W_CheckNumForLongNamePwad(lump, (UINT16)i, fsid);
|
||||
if (check < feid)
|
||||
{
|
||||
return (i<<16) + check; // found it, in our constraints
|
||||
return (i<<16) | check; // found it, in our constraints
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue