fixed evaluation of expressions containing small values
authorMark Linton <linton@ucbvax.Berkeley.EDU>
Tue, 9 Mar 1982 10:58:05 +0000 (02:58 -0800)
committerMark Linton <linton@ucbvax.Berkeley.EDU>
Tue, 9 Mar 1982 10:58:05 +0000 (02:58 -0800)
(i.e. stored in less than a word)

SCCS-vsn: usr.bin/pascal/pdx/tree/eval.c 1.5

usr/src/usr.bin/pascal/pdx/tree/eval.c

index cbac659..7dbc357 100644 (file)
@@ -1,6 +1,6 @@
 /* Copyright (c) 1982 Regents of the University of California */
 
 /* Copyright (c) 1982 Regents of the University of California */
 
-static char sccsid[] = "@(#)eval.c 1.4 %G%";
+static char sccsid[] = "@(#)eval.c 1.5 %G%";
 
 /*
  * Parse tree evaluation.
 
 /*
  * Parse tree evaluation.
@@ -40,7 +40,7 @@ register NODE *p;
            if (isreal(p->op)) {
                fr1 = pop(double);
            } else if (isint(p->op)) {
            if (isreal(p->op)) {
                fr1 = pop(double);
            } else if (isint(p->op)) {
-               r1 = pop(long);
+               r1 = popsmall(p->right->nodetype);
            }
            /* fall through */
        case UNARY:
            }
            /* fall through */
        case UNARY:
@@ -48,7 +48,7 @@ register NODE *p;
            if (isreal(p->op)) {
                fr0 = pop(double);
            } else if (isint(p->op)) {
            if (isreal(p->op)) {
                fr0 = pop(double);
            } else if (isint(p->op)) {
-               r0 = pop(long);
+               r0 = popsmall(p->left->nodetype);
            }
            break;
 
            }
            break;
 
@@ -128,7 +128,7 @@ register NODE *p;
 
        /*
         * Get the value of the expression addressed by the top of the stack.
 
        /*
         * Get the value of the expression addressed by the top of the stack.
-        * Push the result back on the stack.  Never push less than a long.
+        * Push the result back on the stack.
         */
 
        case O_RVAL: {
         */
 
        case O_RVAL: {