4 swcmp(const void *a1, const void *a2)
12 return p1->val > p2->val;
26 for(c = cases; c->link != C; c = c->link) {
29 diag(n, "more than one default in switch");
36 if(isv && !typev[n->type->etype])
37 warn(n, "32-bit switch expression with 64-bit case constant");
39 iq = alloc(nc*sizeof(C1));
41 for(c = cases; c->link != C; c = c->link) {
48 q->val = (long)c->val; /* cast ensures correct value for 32-bit switch on 64-bit architecture */
51 qsort(iq, nc, sizeof(C1), swcmp);
54 print("case %2ld: = %.8llux\n", i, (vlong)iq[i].val);
57 if(iq[i].val == iq[i+1].val) {
58 diag(n, "duplicate cases in switch %lld", (vlong)iq[i].val);
67 swit1(iq, nc, def, n);
75 c = alloc(sizeof(*c));
81 outlstring(ushort *s, long n)
94 if(align(0, types[TCHAR], Aarg1)) {
108 nullwarn(Node *l, Node *r)
110 warn(Z, "result of operation not used");
118 ieeedtod(Ieee *ieee, double native)
124 ieeedtod(ieee, -native);
125 ieee->h |= 0x80000000L;
133 fr = frexp(native, &exp);
134 f = 2097152L; /* shouldnt use fp constants here */
135 fr = modf(fr*f, &ho);
138 ieee->h |= (exp+1022L) << 20;
140 fr = modf(fr*f, &ho);
143 ieee->l |= (long)(fr*f);