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

Work around what appears to be an integer promotion issue

On an aarch64 Chromebook running gcc 12.2.0, these would wrap in
weird ways causing vector fonts to be positioned incorrectly.

It managed to say that (25 - -7) * 4 / 3 == -168
This casting dance appears to resolve the issue.
parent 51644d79
No related branches found
No related tags found
No related merge requests found
Pipeline #7876 passed
...@@ -8654,7 +8654,7 @@ write_char(char ch) ...@@ -8654,7 +8654,7 @@ write_char(char ch)
// yh = font_metrics[rip.font.num][3].base * mult / div; // yh = font_metrics[rip.font.num][3].base * mult / div;
   
// This way seems insane... but seems to work. // This way seems insane... but seems to work.
yh = (((char)rip_fonts[rip.font.num - 1][0x88]) - ((char)rip_fonts[rip.font.num - 1][0x8a])) * mult yh = (((signed char)rip_fonts[rip.font.num - 1][0x88]) - ((signed char)rip_fonts[rip.font.num - 1][0x8a])) * mult
/ div; / div;
   
// printf("Font: %d @ %d\n", rip.font.num, rip.font.size); // printf("Font: %d @ %d\n", rip.font.num, rip.font.size);
...@@ -8680,8 +8680,8 @@ write_char(char ch) ...@@ -8680,8 +8680,8 @@ write_char(char ch)
cx |= 0x80; cx |= 0x80;
if (cy & 0x40) if (cy & 0x40)
cy |= 0x80; cy |= 0x80;
bcx = (cx * mult) / div; bcx = ((signed char)cx * mult) / div;
bcy = (cy * mult) / div; bcy = ((signed char)cy * mult) / div;
if (rip.font.vertical) { if (rip.font.vertical) {
dx = yh - bcy; dx = yh - bcy;
dy = -bcx; dy = -bcx;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment