Skip to content
Snippets Groups Projects
Commit 2be3fef5 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Don't calculate the same value twice.

parent 66864ebe
No related branches found
No related tags found
No related merge requests found
...@@ -668,6 +668,7 @@ draw_char_row(struct blockstate *bs, struct charstate *cs, uint32_t y) ...@@ -668,6 +668,7 @@ draw_char_row(struct blockstate *bs, struct charstate *cs, uint32_t y)
uint8_t fb = cs->font[cs->fontoffset]; uint8_t fb = cs->font[cs->fontoffset];
for(unsigned x = 0; x < vstat.charwidth; x++) { for(unsigned x = 0; x < vstat.charwidth; x++) {
unsigned bitnum = x & 0x07;
if (bs->expand && x == bs->font_data_width) { if (bs->expand && x == bs->font_data_width) {
if (cs->gexpand) if (cs->gexpand)
fbb = cs->font[cs->fontoffset - 1] & (0x80 >> ((x - 1) & 7)); fbb = cs->font[cs->fontoffset - 1] & (0x80 >> ((x - 1) & 7));
...@@ -675,9 +676,9 @@ draw_char_row(struct blockstate *bs, struct charstate *cs, uint32_t y) ...@@ -675,9 +676,9 @@ draw_char_row(struct blockstate *bs, struct charstate *cs, uint32_t y)
fbb = 0; fbb = 0;
} }
else else
fbb = fb & (0x80 >> (x & 7)); fbb = fb & (0x80 >> bitnum);
if ((x & 0x07) == 7) { if (bitnum == 7) {
cs->fontoffset++; cs->fontoffset++;
fb = cs->font[cs->fontoffset]; fb = cs->font[cs->fontoffset];
} }
...@@ -725,6 +726,7 @@ draw_char_row_double(struct blockstate *bs, struct charstate *cs, uint32_t y) ...@@ -725,6 +726,7 @@ draw_char_row_double(struct blockstate *bs, struct charstate *cs, uint32_t y)
uint8_t fb = cs->font[cs->fontoffset]; uint8_t fb = cs->font[cs->fontoffset];
for(unsigned x = 0; x < vstat.charwidth; x++) { for(unsigned x = 0; x < vstat.charwidth; x++) {
unsigned bitnum = x & 0x07;
if (bs->expand && x == bs->font_data_width) { if (bs->expand && x == bs->font_data_width) {
if (cs->gexpand) if (cs->gexpand)
fbb = cs->font[cs->fontoffset - 1] & (0x80 >> ((x - 1) & 7)); fbb = cs->font[cs->fontoffset - 1] & (0x80 >> ((x - 1) & 7));
...@@ -732,9 +734,9 @@ draw_char_row_double(struct blockstate *bs, struct charstate *cs, uint32_t y) ...@@ -732,9 +734,9 @@ draw_char_row_double(struct blockstate *bs, struct charstate *cs, uint32_t y)
fbb = 0; fbb = 0;
} }
else else
fbb = fb & (0x80 >> (x & 7)); fbb = fb & (0x80 >> bitnum);
if ((x & 0x07) == 7) { if (bitnum == 7) {
cs->fontoffset++; cs->fontoffset++;
fb = cs->font[cs->fontoffset]; fb = cs->font[cs->fontoffset];
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment