commit 101edd9a3b5d71aecd5ed30c70b2ad011e27a66d
Author:     Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Wed Aug 26 22:22:05 2015 +0200
Commit:     Roberto E. Vargas Caballero <[email protected]>
CommitDate: Wed Aug 26 22:22:05 2015 +0200

    Emit pointer constants
    
    Pointer constants have the same representation than TUINT values,
    so they can share the code.

diff --git a/cc1/code.c b/cc1/code.c
index e8d79d4..fac9010 100644
--- a/cc1/code.c
+++ b/cc1/code.c
@@ -181,10 +181,14 @@ emitconst(Node *np)
 {
        char *bp, c;
        Symbol *sym = np->sym;
+       Type *tp = np->type;
+       TUINT u;
 
-       switch (BTYPE(np)) {
+       switch (tp->op) {
+       case PTR:
        case INT:
-               printf("#%c%lX", np->type->letter, (long) sym->u.i);
+               u = (tp->sign) ? (TUINT) sym->u.i : sym->u.u;
+               printf("#%c%lX", np->type->letter, sym->u.i);
                break;
        case ARY:
                /*

Reply via email to