Fix: DIV and MOD on negative args

This commit is contained in:
ceriel
1990-07-16 09:05:19 +00:00
parent 2acd7638cc
commit 396c70c16e
4 changed files with 89 additions and 15 deletions

View File

@@ -782,7 +782,13 @@ CodeOper(expr, true_label, false_label)
Operands(expr);
switch(tp->tp_fund) {
case T_INTEGER:
C_dvi(tp->tp_size);
if ((int)(tp->tp_size) == word_size) {
C_cal((int)(tp->tp_size) == (int)word_size
? "dvi"
: "dvil");
}
C_asp(2*tp->tp_size);
C_lfr(tp->tp_size);
break;
case T_POINTER:
case T_EQUAL:
@@ -798,7 +804,13 @@ CodeOper(expr, true_label, false_label)
Operands(expr);
switch(tp->tp_fund) {
case T_INTEGER:
C_rmi(tp->tp_size);
if ((int)(tp->tp_size) == word_size) {
C_cal((int)(tp->tp_size) == (int)word_size
? "rmi"
: "rmil");
}
C_asp(2*tp->tp_size);
C_lfr(tp->tp_size);
break;
case T_POINTER:
case T_EQUAL: