fix: optimize for bare-metal HashFunSegFind, DCBlotColor8, GrCalcScreenUpdates, GrUpdateScreen32; inc patch num

This commit is contained in:
GutPuncher 2024-03-24 05:20:13 -04:00
parent cd46dc4ab3
commit 4eaf4f7205
No known key found for this signature in database
GPG key ID: 38CE0A7B6841D1C7
3 changed files with 43 additions and 24 deletions

View file

@ -12,19 +12,24 @@ U0 HashFunSegFind(CHashTable *h, U8 *addr, Bool *_has_lower, U64 *_best, CHash *
{
Bool *has_lower = *_has_lower;
CHashExport *tmpex;
U64 i, j, best = *_best;
CHash *res = *_res;
U64 i, j, best = *_best, reg mask = h->mask;
CHash *res = *_res, **body = h->body;;
CHashFun *temp_hashfun;
U16 hf_flags;
for (i = 0; i <= h->mask; i++)
for (i = 0; i <= mask; i++)
{
tmpex = h->body[i];
tmpex = body[i];
while (tmpex)
{
j = 0;
if (tmpex->type & HTT_FUN)
{
if (!Bt(&tmpex(CHashFun *)->flags, Cf_EXTERN) && !Bt(&tmpex(CHashFun *)->flags, Ff_INTERNAL))
j = tmpex(CHashFun *)->exe_addr;
temp_hashfun = tmpex; // cast
hf_flags = temp_hashfun->flags;
if (!Bt(&hf_flags, Cf_EXTERN) && !Bt(&hf_flags, Ff_INTERNAL))
j = temp_hashfun->exe_addr;
}
else if (tmpex->type & HTT_EXPORT_SYS_SYM)
j = tmpex->val;

View file

@ -14,7 +14,7 @@ U8 *rev_bits_table; //Table with U8 bits reversed
CDate local_time_offset;
F64 *pow10_I64,
sys_os_version = 2.03;
U64 sys_os_version_sub = 117;
U64 sys_os_version_sub = 118;
U8 *sys_os_version_str;
U8 *sys_os_version_full;
U8 *sys_os_version_nice;

View file

@ -345,22 +345,29 @@ U0 GrUpdateTextFG()
U0 DCBlotColor8(CDC *dc, CDC *img)
{
U8 *src = img->body, *b0 = dc->body;
I64 j, k, d0 = img->width_internal * img->height;
I64 reg j, reg jj, v = 0, k, d0 = img->width_internal * img->height;
for (k = 0; k < d0; k++)
for (k = 0; k < d0; k += 8)
{
j = *src++;
if (j != TRANSPARENT)
*b0++ = j;
else
j = *(src(U64 *));
src += 8;
do
{
jj = j & 0xFF;
if (jj != TRANSPARENT)
*b0 = jj;
b0++;
j >>= 8;
} while (v++ < 8);
}
}
U0 GrCalcScreenUpdates()
{
U16 *screen, *last_screen = gr.screen_cache;
U64 i, *src = text.raw_screen, *dst = text.fb_alias, diffs_size = GR_WIDTH * GR_HEIGHT / 2;
U64 *screen, *last_screen = gr.screen_cache;
U64 i, *src = text.raw_screen, *dst = text.fb_alias, diffs_size = GR_WIDTH * GR_HEIGHT / 8;
if (gr.screen_zoom == 1)
screen = gr.dc2->body;
@ -368,17 +375,16 @@ U0 GrCalcScreenUpdates()
screen = gr.zoomed_dc->body;
for (i = 0; i < diffs_size; i++)
{
if (screen[i] != last_screen[i])
dst[i] = src[i];
}
MemCopy(gr.screen_cache, screen, diffs_size * 2);
MemCopy(dst + i * 4, src + i * 4, 4 * 64);
MemCopy(gr.screen_cache, screen, diffs_size * 8);
}
U0 GrUpdateScreen32()
{
U64 size, *dst;
U8 *src;
U64 size, *dst, reg src64val;
U8 *src, reg a, reg b, c, reg d;
if (gr.screen_zoom == 1)
{
@ -392,9 +398,17 @@ U0 GrUpdateScreen32()
size = src + gr.zoomed_dc->height * gr.zoomed_dc->width_internal;
}
dst = text.raw_screen;
while (src < size) //draw 2 pixels at a time
*dst++ = gr_palette[*src++ & 0xFF] | gr_palette[*src++ & 0xFF] << 32;
while (src < size) // draw 4 pixels at a time
{
src64val = *(src(U64 *));
a = src64val & 0xFF;
b = (src64val >>= 8) & 0xFF;
c = (src64val >>= 8) & 0xFF;
d = (src64val >>= 8) & 0xFF;
src += 4;
*dst++ = gr_palette[a] | gr_palette[b] << 32;
*dst++ = gr_palette[c] | gr_palette[d] << 32;
}
GrCalcScreenUpdates;