shithub: mc

Download patch

ref: 4a9ebe2a52eaf6d632f8f092fcb5a860205b026c
parent: 10693cab889e841aa758da1f6fd5fe5148510672
author: Ori Bernstein <[email protected]>
date: Fri Jul 27 11:11:39 EDT 2012

Write chars out as longs.

    They're 32 bit values. Treat them as such.

--- a/8/isel.c
+++ b/8/isel.c
@@ -809,7 +809,7 @@
         if (isprint(p[i]))
             fprintf(fd, "%c", p[i]);
         else
-            fprintf(fd, "\\%x", p[i]);
+            fprintf(fd, "\\x%x", p[i] & 0xff);
         /* line wrapping for readability */
         if (i % 60 == 59 || i == sz - 1)
             fprintf(fd, "\"\n");
@@ -824,7 +824,7 @@
     assert(v->type == Nlit);
     switch (v->lit.littype) {
         case Lbool:     fprintf(fd, "\t.long %d\n", v->lit.boolval);     break;
-        case Lchr:      fprintf(fd, "\t.byte %d\n",  v->lit.chrval);     break;
+        case Lchr:      fprintf(fd, "\t.long %d\n",  v->lit.chrval);     break;
         case Lint:      fprintf(fd, "\t.long %lld\n", v->lit.intval);    break;
         case Lflt:      fprintf(fd, "\t.double %f\n", v->lit.fltval);    break;
         case Lstr:      fprintf(fd, "\t.long %s\n", genlblstr(lbl, 128));