diff options
| author | forsyth <forsyth@vitanuova.com> | 2010-04-27 21:15:13 +0100 |
|---|---|---|
| committer | forsyth <forsyth@vitanuova.com> | 2010-04-27 21:15:13 +0100 |
| commit | c0927006217e7a7e0214add5828659287c7498d6 (patch) | |
| tree | 528acb9e0df2d33eaa2481b8e3ff37c252082fd2 /utils/8c/swt.c | |
| parent | 2303ddadf6e5cbf9705ccf25abe6114af1126b79 (diff) | |
20100427-2115
Diffstat (limited to 'utils/8c/swt.c')
| -rw-r--r-- | utils/8c/swt.c | 128 |
1 files changed, 0 insertions, 128 deletions
diff --git a/utils/8c/swt.c b/utils/8c/swt.c index a29b95c7..46fd71eb 100644 --- a/utils/8c/swt.c +++ b/utils/8c/swt.c @@ -1,57 +1,5 @@ #include "gc.h" -int -swcmp(const void *a1, const void *a2) -{ - C1 *p1, *p2; - - p1 = (C1*)a1; - p2 = (C1*)a2; - if(p1->val < p2->val) - return -1; - return p1->val > p2->val; -} - -void -doswit(Node *n) -{ - Case *c; - C1 *q, *iq; - long def, nc, i; - - def = 0; - nc = 0; - for(c = cases; c->link != C; c = c->link) { - if(c->def) { - if(def) - diag(n, "more than one default in switch"); - def = c->label; - continue; - } - nc++; - } - - iq = alloc(nc*sizeof(C1)); - q = iq; - for(c = cases; c->link != C; c = c->link) { - if(c->def) - continue; - q->label = c->label; - q->val = c->val; - q++; - } - qsort(iq, nc, sizeof(C1), swcmp); - if(debug['W']) - for(i=0; i<nc; i++) - print("case %2ld: = %.8lux\n", i, iq[i].val); - if(def == 0) - def = breakpc; - for(i=0; i<nc-1; i++) - if(iq[i].val == iq[i+1].val) - diag(n, "duplicate cases in switch %ld", iq[i].val); - swit1(iq, nc, def, n); -} - void swit1(C1 *q, int nc, long def, Node *n) { @@ -89,16 +37,6 @@ swit1(C1 *q, int nc, long def, Node *n) } void -casf(void) -{ - Case *c; - - c = alloc(sizeof(*c)); - c->link = cases; - cases = c; -} - -void bitload(Node *b, Node *n1, Node *n2, Node *n3, Node *nn) { int sh; @@ -189,43 +127,6 @@ outstring(char *s, long n) return r; } -long -outlstring(ushort *s, long n) -{ - char buf[2]; - int c; - long r; - - if(suppress) - return nstring; - while(nstring & 1) - outstring("", 1); - r = nstring; - while(n > 0) { - c = *s++; - if(align(0, types[TCHAR], Aarg1)) { - buf[0] = c>>8; - buf[1] = c; - } else { - buf[0] = c; - buf[1] = c>>8; - } - outstring(buf, 2); - n -= sizeof(ushort); - } - return r; -} - -void -nullwarn(Node *l, Node *r) -{ - warn(Z, "result of operation not used"); - if(l != Z) - cgen(l, Z); - if(r != Z) - cgen(r, Z); -} - void sextern(Sym *s, Node *a, long o, long w) { @@ -542,35 +443,6 @@ zaddr(Biobuf *b, Adr *a, int s) Bputc(b, a->type); } -void -ieeedtod(Ieee *ieee, double native) -{ - double fr, ho, f; - int exp; - - if(native < 0) { - ieeedtod(ieee, -native); - ieee->h |= 0x80000000L; - return; - } - if(native == 0) { - ieee->l = 0; - ieee->h = 0; - return; - } - fr = frexp(native, &exp); - f = 2097152L; /* shouldnt use fp constants here */ - fr = modf(fr*f, &ho); - ieee->h = ho; - ieee->h &= 0xfffffL; - ieee->h |= (exp+1022L) << 20; - f = 65536L; - fr = modf(fr*f, &ho); - ieee->l = ho; - ieee->l <<= 16; - ieee->l |= (long)(fr*f); -} - long align(long i, Type *t, int op) { |
