mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-29 23:23:07 +00:00
- got rid of clearbuf.
This was used in only 4 places, 3 of which could easily be replaced with a memset, and the fourth, in the Strife status bar, suffering from a pointless performance optimization, rendering the code unreadable - the code spent here per frame is utterly insignificant so clarity should win here.
(cherry picked from commit 12a99c3f3c
)
This commit is contained in:
parent
695b08ed4b
commit
c61f30a627
6 changed files with 6 additions and 41 deletions
|
@ -177,15 +177,6 @@ static inline SDWORD DivScale30 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)
|
|||
static inline SDWORD DivScale31 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 31) / b); }
|
||||
static inline SDWORD DivScale32 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 32) / b); }
|
||||
|
||||
static __forceinline void clearbuf (void *buff, unsigned int count, SDWORD clear)
|
||||
{
|
||||
SDWORD *b2 = (SDWORD *)buff;
|
||||
for (unsigned int i = 0; i != count; ++i)
|
||||
{
|
||||
b2[i] = clear;
|
||||
}
|
||||
}
|
||||
|
||||
static __forceinline void clearbufshort (void *buff, unsigned int count, WORD clear)
|
||||
{
|
||||
SWORD *b2 = (SWORD *)buff;
|
||||
|
|
|
@ -169,14 +169,10 @@ void FHealthBar::MakeTexture ()
|
|||
|
||||
void FHealthBar::FillBar (int min, int max, BYTE light, BYTE dark)
|
||||
{
|
||||
#ifdef __BIG_ENDIAN__
|
||||
SDWORD fill = (light << 24) | (dark << 16) | (light << 8) | dark;
|
||||
#else
|
||||
SDWORD fill = light | (dark << 8) | (light << 16) | (dark << 24);
|
||||
#endif
|
||||
if (max > min)
|
||||
for (int i = min*2; i < max*2; i++)
|
||||
{
|
||||
clearbuf (&Pixels[min*4], max - min, fill);
|
||||
Pixels[i * 2] = light;
|
||||
Pixels[i * 2 + 1] = dark;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -291,19 +291,6 @@ static inline SDWORD DivScale32 (SDWORD a, SDWORD b)
|
|||
return result;
|
||||
}
|
||||
|
||||
static inline void clearbuf (void *buff, int count, SDWORD clear)
|
||||
{
|
||||
int dummy1, dummy2;
|
||||
asm volatile
|
||||
("rep stosl"
|
||||
:"=D" (dummy1),
|
||||
"=c" (dummy2)
|
||||
: "D" (buff),
|
||||
"c" (count),
|
||||
"a" (clear)
|
||||
);
|
||||
}
|
||||
|
||||
static inline void clearbufshort (void *buff, unsigned int count, WORD clear)
|
||||
{
|
||||
asm volatile
|
||||
|
|
|
@ -321,15 +321,6 @@ __forceinline SDWORD DivScale32 (SDWORD a, SDWORD b)
|
|||
__asm idiv b
|
||||
}
|
||||
|
||||
__forceinline void clearbuf (void *buff, unsigned int count, SDWORD clear)
|
||||
{
|
||||
SDWORD *b2 = (SDWORD *)buff;
|
||||
for (unsigned int i = 0; i != count; ++i)
|
||||
{
|
||||
b2[i] = clear;
|
||||
}
|
||||
}
|
||||
|
||||
__forceinline void clearbufshort (void *buff, unsigned int count, WORD clear)
|
||||
{
|
||||
SWORD *b2 = (SWORD *)buff;
|
||||
|
|
|
@ -925,7 +925,7 @@ void FBlockThingsIterator::init(const FBoundingBox &box)
|
|||
|
||||
void FBlockThingsIterator::ClearHash()
|
||||
{
|
||||
clearbuf(Buckets, countof(Buckets), -1);
|
||||
memset(Buckets, -1, sizeof(Buckets));
|
||||
NumFixedHash = 0;
|
||||
DynHash.Clear();
|
||||
}
|
||||
|
|
|
@ -270,7 +270,7 @@ void R_InitSpriteDefs ()
|
|||
// Create a hash table to speed up the process
|
||||
smax = TexMan.NumTextures();
|
||||
hashes = new Hasher[smax];
|
||||
clearbuf(hashes, sizeof(Hasher)*smax/4, -1);
|
||||
memset(hashes, -1, sizeof(Hasher)*smax);
|
||||
for (i = 0; i < smax; ++i)
|
||||
{
|
||||
FTexture *tex = TexMan.ByIndex(i);
|
||||
|
@ -285,7 +285,7 @@ void R_InitSpriteDefs ()
|
|||
// Repeat, for voxels
|
||||
vmax = Wads.GetNumLumps();
|
||||
vhashes = new VHasher[vmax];
|
||||
clearbuf(vhashes, sizeof(VHasher)*vmax/4, -1);
|
||||
memset(vhashes, -1, sizeof(VHasher)*vmax);
|
||||
for (i = 0; i < vmax; ++i)
|
||||
{
|
||||
if (Wads.GetLumpNamespace(i) == ns_voxels)
|
||||
|
|
Loading…
Reference in a new issue