Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4)

Side by Side Diff: src/cmd/gc/const.c

Issue 311041: code review 311041: gc: simplify complex typecheck (Closed)
Patch Set: code review 311041: gc: simplify complex typecheck Created 15 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/cmd/gc/print.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 #include "go.h" 5 #include "go.h"
6 #define TUP(x,y) (((x)<<16)|(y)) 6 #define TUP(x,y) (((x)<<16)|(y))
7 7
8 static Val tocplx(Val); 8 static Val tocplx(Val);
9 static Val toflt(Val); 9 static Val toflt(Val);
10 static Val tostr(Val); 10 static Val tostr(Val);
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 } 881 }
882 return n; 882 return n;
883 } 883 }
884 884
885 Node* 885 Node*
886 nodcplxlit(Val r, Val i) 886 nodcplxlit(Val r, Val i)
887 { 887 {
888 Node *n; 888 Node *n;
889 Mpcplx *c; 889 Mpcplx *c;
890 890
891 r = toflt(r);
892 i = toflt(i);
893
891 c = mal(sizeof(*c)); 894 c = mal(sizeof(*c));
892 n = nod(OLITERAL, N, N); 895 n = nod(OLITERAL, N, N);
893 n->type = types[TIDEAL]; 896 n->type = types[TIDEAL];
894 n->val.u.cval = c; 897 n->val.u.cval = c;
895 n->val.ctype = CTCPLX; 898 n->val.ctype = CTCPLX;
896 899
897 if(r.ctype != CTFLT || i.ctype != CTFLT) 900 if(r.ctype != CTFLT || i.ctype != CTFLT)
898 fatal("nodcplxlit ctype %d/%d", r.ctype, i.ctype); 901 fatal("nodcplxlit ctype %d/%d", r.ctype, i.ctype);
899 902
900 mpmovefltflt(&c->real, r.u.fval); 903 mpmovefltflt(&c->real, r.u.fval);
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 mpmulfltflt(&ad, &rv->imag); // ad 1257 mpmulfltflt(&ad, &rv->imag); // ad
1255 1258
1256 mpmovefltflt(&v->real, &ac); 1259 mpmovefltflt(&v->real, &ac);
1257 mpaddfltflt(&v->real, &bd); // ac+bd 1260 mpaddfltflt(&v->real, &bd); // ac+bd
1258 mpdivfltflt(&v->real, &cc_plus_dd); // (ac+bd)/(cc+dd) 1261 mpdivfltflt(&v->real, &cc_plus_dd); // (ac+bd)/(cc+dd)
1259 1262
1260 mpmovefltflt(&v->imag, &bc); 1263 mpmovefltflt(&v->imag, &bc);
1261 mpsubfltflt(&v->imag, &ad); // bc-ad 1264 mpsubfltflt(&v->imag, &ad); // bc-ad
1262 mpdivfltflt(&v->imag, &cc_plus_dd); // (bc+ad)/(cc+dd) 1265 mpdivfltflt(&v->imag, &cc_plus_dd); // (bc+ad)/(cc+dd)
1263 } 1266 }
OLDNEW
« no previous file with comments | « no previous file | src/cmd/gc/print.c » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b