home *** CD-ROM | disk | FTP | other *** search
- *** ops.c.orig Tue Jul 11 10:56:04 1989
- --- ops.c Tue Jul 11 11:07:49 1989
- ***************
- *** 36,53 ****
-
- #define low_order(b, x) ((((unsigned) 0xffffffff) >> (32 - (b))) & (x))
-
- PRIVATE pop_op()
-
- { int i, temp;
-
- if (curr_mode != SCIENTIFIC && o_stack[o_top - 1]) {
- ! v_stack[v_top] = (double) low_order(curr_width[index_of(curr_base)], (unsigned int) v_stack[v_top]);
- ! v_stack[v_top - 1] = (double) low_order(curr_width[index_of(curr_base)], (unsigned int) v_stack[v_top - 1]);
- }
- switch (o_stack[--o_top]) {
- case ADD_OP : v_stack[v_top - 1] += v_stack[v_top];
- break;
- ! case AND_OP : temp = ((unsigned int) v_stack[v_top - 1]) & ((unsigned int) v_stack[v_top]);
- v_stack[v_top - 1] = (double) temp;
- break;
- case DIV_OP : v_stack[v_top - 1] /= v_stack[v_top];
- --- 36,62 ----
-
- #define low_order(b, x) ((((unsigned) 0xffffffff) >> (32 - (b))) & (x))
-
- + /************************************************************************/
- + /* In the following code, the apparently extraneous assignments */
- + /* to vt1 and vt2 are used to circumvent a bug in the 386i C compiler */
- + /* which hangs when trying to compile code which casts a (double *) to */
- + /* (unsigned int). Sigh... */
- + /************************************************************************/
- +
- + PRIVATE double vt1, vt2;
- +
- PRIVATE pop_op()
-
- { int i, temp;
-
- if (curr_mode != SCIENTIFIC && o_stack[o_top - 1]) {
- ! v_stack[v_top] = (double) low_order(curr_width[index_of(curr_base)], (unsigned int) (vt1 = v_stack[v_top]));
- ! v_stack[v_top - 1] = (double) low_order(curr_width[index_of(curr_base)], (unsigned int) (vt2 = v_stack[v_top - 1]));
- }
- switch (o_stack[--o_top]) {
- case ADD_OP : v_stack[v_top - 1] += v_stack[v_top];
- break;
- ! case AND_OP : temp = ((unsigned int) (vt1 = v_stack[v_top - 1])) & ((unsigned int) (vt2 = v_stack[v_top]));
- v_stack[v_top - 1] = (double) temp;
- break;
- case DIV_OP : v_stack[v_top - 1] /= v_stack[v_top];
- ***************
- *** 54,86 ****
- break;
- case LPAREN_OP : return;
- break;
- ! case LSL_OP : temp = ((unsigned int) v_stack[v_top - 1]) << ((unsigned int) v_stack[v_top]);
- v_stack[v_top - 1] = (double) temp;
- break;
- case MUL_OP : v_stack[v_top - 1] *= v_stack[v_top];
- break;
- ! case OR_OP : temp = ((unsigned int) v_stack[v_top - 1]) | ((unsigned int) v_stack[v_top]);
- v_stack[v_top - 1] = (double) temp;
- break;
- ! case ROL_OP : for (i = (unsigned int) v_stack[v_top], temp = (unsigned int) v_stack[v_top - 1]; i; i--)
- temp = (temp << 1) + ((((unsigned) temp) >> (curr_width[index_of(curr_base)] - 1)) & 1);
- v_stack[v_top - 1] = (double) low_order(curr_width[index_of(curr_base)], temp);
- break;
- case ROOT_OP : v_stack[v_top - 1] = pow(v_stack[v_top - 1], 1.0 / v_stack[v_top]);
- break;
- ! case ROR_OP : for (i = (unsigned int) v_stack[v_top], temp = (unsigned int) v_stack[v_top - 1]; i; i--)
- temp = (((unsigned) temp) >> 1) + ((temp & 1) << (curr_width[index_of(curr_base)] - 1));
- v_stack[v_top - 1] = (double) low_order(curr_width[index_of(curr_base)], temp);
- break;
- ! case RSA_OP : temp = ((unsigned int) v_stack[v_top - 1]) >> ((unsigned int) v_stack[v_top]);
- v_stack[v_top - 1] = (double) temp;
- break;
- ! case RSL_OP : temp = ((unsigned int) ((unsigned int) v_stack[v_top - 1])) >> ((unsigned int) v_stack[v_top]);
- v_stack[v_top - 1] = (double) temp;
- break;
- case SUB_OP : v_stack[v_top - 1] -= v_stack[v_top];
- break;
- ! case XOR_OP : temp = ((unsigned int) v_stack[v_top - 1]) ^ ((unsigned int) v_stack[v_top]);
- v_stack[v_top - 1] = (double) temp;
- break;
- case Y2X_OP : v_stack[v_top - 1] = pow(v_stack[v_top - 1], v_stack[v_top]);
- --- 63,95 ----
- break;
- case LPAREN_OP : return;
- break;
- ! case LSL_OP : temp = ((unsigned int) (vt1 = v_stack[v_top - 1])) << ((unsigned int) (vt2 = v_stack[v_top]));
- v_stack[v_top - 1] = (double) temp;
- break;
- case MUL_OP : v_stack[v_top - 1] *= v_stack[v_top];
- break;
- ! case OR_OP : temp = ((unsigned int) (vt1 = v_stack[v_top - 1])) | ((unsigned int) (vt2 = v_stack[v_top]));
- v_stack[v_top - 1] = (double) temp;
- break;
- ! case ROL_OP : for (i = (unsigned int) (vt1 = v_stack[v_top]), temp = (unsigned int) (vt2 = v_stack[v_top - 1]); i; i--)
- temp = (temp << 1) + ((((unsigned) temp) >> (curr_width[index_of(curr_base)] - 1)) & 1);
- v_stack[v_top - 1] = (double) low_order(curr_width[index_of(curr_base)], temp);
- break;
- case ROOT_OP : v_stack[v_top - 1] = pow(v_stack[v_top - 1], 1.0 / v_stack[v_top]);
- break;
- ! case ROR_OP : for (i = (unsigned int) (vt1 = v_stack[v_top]), temp = (unsigned int) (vt2 = v_stack[v_top - 1]); i; i--)
- temp = (((unsigned) temp) >> 1) + ((temp & 1) << (curr_width[index_of(curr_base)] - 1));
- v_stack[v_top - 1] = (double) low_order(curr_width[index_of(curr_base)], temp);
- break;
- ! case RSA_OP : temp = ((unsigned int) (vt1 = v_stack[v_top - 1])) >> ((unsigned int) (vt2 = v_stack[v_top]));
- v_stack[v_top - 1] = (double) temp;
- break;
- ! case RSL_OP : temp = ((unsigned int) (vt1 = v_stack[v_top - 1])) >> ((unsigned int) (vt2 = v_stack[v_top]));
- v_stack[v_top - 1] = (double) temp;
- break;
- case SUB_OP : v_stack[v_top - 1] -= v_stack[v_top];
- break;
- ! case XOR_OP : temp = ((unsigned int) (vt1 = v_stack[v_top - 1])) ^ ((unsigned int) (vt2 = v_stack[v_top]));
- v_stack[v_top - 1] = (double) temp;
- break;
- case Y2X_OP : v_stack[v_top - 1] = pow(v_stack[v_top - 1], v_stack[v_top]);
- ***************
- *** 199,205 ****
- break;
- case LOG_OP : v_stack[v_top] = log10(v_stack[v_top]);
- break;
- ! case NOT_OP : v_stack[v_top] = (double) low_order(curr_width[index_of(curr_base)], (~ (unsigned int) v_stack[v_top]));
- break;
- case OVER_OP : v_stack[v_top] = 1.0 / v_stack[v_top];
- break;
- --- 208,214 ----
- break;
- case LOG_OP : v_stack[v_top] = log10(v_stack[v_top]);
- break;
- ! case NOT_OP : v_stack[v_top] = (double) low_order(curr_width[index_of(curr_base)], (~ (unsigned int) (vt1 = v_stack[v_top])));
- break;
- case OVER_OP : v_stack[v_top] = 1.0 / v_stack[v_top];
- break;
-