1
0
mirror of https://github.com/golang/go synced 2024-11-20 01:14:40 -07:00

cmd/gc: implement revised rule for shifts in equality.

R=rsc, daniel.morsing
CC=golang-dev
https://golang.org/cl/7613046
This commit is contained in:
Rémy Oudompheng 2013-03-20 00:19:11 +01:00
parent 1b6b1bc66e
commit 465ff4cfc0

View File

@ -1211,6 +1211,7 @@ void
defaultlit2(Node **lp, Node **rp, int force)
{
Node *l, *r;
int lkind, rkind;
l = *lp;
r = *rp;
@ -1230,18 +1231,20 @@ defaultlit2(Node **lp, Node **rp, int force)
convlit(lp, types[TBOOL]);
convlit(rp, types[TBOOL]);
}
if(isconst(l, CTCPLX) || isconst(r, CTCPLX)) {
lkind = idealkind(l);
rkind = idealkind(r);
if(lkind == CTCPLX || rkind == CTCPLX) {
convlit(lp, types[TCOMPLEX128]);
convlit(rp, types[TCOMPLEX128]);
return;
}
if(isconst(l, CTFLT) || isconst(r, CTFLT)) {
if(lkind == CTFLT || rkind == CTFLT) {
convlit(lp, types[TFLOAT64]);
convlit(rp, types[TFLOAT64]);
return;
}
if(isconst(l, CTRUNE) || isconst(r, CTRUNE)) {
if(lkind == CTRUNE || rkind == CTRUNE) {
convlit(lp, runetype);
convlit(rp, runetype);
return;