Commit f70e2851 authored by Ken Thompson's avatar Ken Thompson

bug in int8 mod

R=rsc
OCL=32971
CL=32971
parent e4603db3
......@@ -600,7 +600,6 @@ cgen_div(int op, Node *nl, Node *nr, Node *res)
if(n < 0)
goto divbymul;
switch(n) {
case 0:
// divide by 1
......@@ -618,7 +617,7 @@ cgen_div(int op, Node *nl, Node *nr, Node *res)
// divide by 2
if(op == OMOD) {
if(issigned[nl->type->etype])
goto longmod;
goto longdiv;
regalloc(&n1, nl->type, res);
cgen(nl, &n1);
nodconst(&n2, nl->type, 1);
......@@ -643,7 +642,7 @@ cgen_div(int op, Node *nl, Node *nr, Node *res)
default:
if(op == OMOD) {
if(issigned[nl->type->etype])
goto longmod;
goto longdiv;
regalloc(&n1, nl->type, res);
cgen(nl, &n1);
nodconst(&n2, nl->type, mpgetfix(nr->val.u.xval)-1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment