- Use uint8_t for font bit storage and manipulation instead of
authorMatthew Mondor <mmondor@pulsar-zone.net>
Sun, 10 Apr 2022 00:46:28 +0000 (00:46 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Sun, 10 Apr 2022 00:46:28 +0000 (00:46 +0000)
  unsigned long, since no significant performance improvement.

hacks/analogterm.c
hacks/analogterm.h

index 47f6550..de14d2d 100644 (file)
@@ -343,7 +343,7 @@ at_make_font(analogterm_sim_t *sim, int fi, char *bits, unsigned int width,
 {
        Pixmap pm;
        XImage *xi;
-       unsigned long (*f)[8][7];
+       uint8_t (*f)[8][7];
        int c, r, b;
 
        assert(width == 96 * 7 && height == 8);
@@ -358,7 +358,8 @@ at_make_font(analogterm_sim_t *sim, int fi, char *bits, unsigned int width,
        for (c = 0; c < 96; c++) {
                for (r = 0; r < 8; r++) {
                        for (b = 0; b < 7; b++)
-                               f[c][r][b] = XGetPixel(xi, (c * 7) + b, r % 8);
+                               f[c][r][b] = (uint8_t)XGetPixel(xi,
+                                   (c * 7) + b, r % 8);
                }
        }
 
@@ -592,9 +593,8 @@ analogterm_one_frame (analogterm_sim_t *sim)
             int rev, level, olevel, iblink;
             int c = st->textlines_char[textrow][col];
            uint16_t m = st->textlines_mode[textrow][col];
-           unsigned long (*f)[8][7] =
-               sim->text_font[(m & TMODE_GFX) != 0 ? 1 : 0];
-           unsigned long (*cf)[7];
+           uint8_t (*f)[8][7] = sim->text_font[(m & TMODE_GFX) != 0 ? 1 : 0];
+           uint8_t (*cf)[7];
 
            rev = ((m & (TMODE_INVERSE | TMODE_BGCOLOR)) != 0);
 
@@ -629,7 +629,7 @@ analogterm_one_frame (analogterm_sim_t *sim)
             * resolution.
             */
             for (i = 0; i < 7; i++) {
-               unsigned long *cb = cf[rowm], pix;
+               uint8_t *cb = cf[rowm], pix;
 
                if ((m & TMODE_INVISIBLE) != 0)
                        pix = 0;
index e263f78..db4d530 100644 (file)
@@ -83,7 +83,7 @@ struct analogterm_sim_s {
   Display *dpy;
   Window window;
   XWindowAttributes xgwa;
-  unsigned long text_font[CHARSETS][96][8][7];
+  uint8_t text_font[CHARSETS][96][8][7];
 
   struct timeval basetime_tv;
   double curtime;