Annotation of researchv10no/cmd/lcc/gen2/sparc/decode.c, revision 1.1.1.1

1.1       root        1: /* C compiler: SPARC float/double decoding */
                      2: 
                      3: #include "c.h"
                      4: 
                      5: struct real decode(ty, x) double x; {
                      6:        struct real r;
                      7: 
                      8:        if (ty == D) {
                      9:                struct d { unsigned sign:1, exp:11, fract1:20, fract2; }
                     10:                        *p = (struct d *) &x;
                     11:                r.sign = p->sign;
                     12:                r.exp = x ? p->exp - 1023 : 0;
                     13:                r.msb = (p->fract1<<12) | (p->fract2>>20);
                     14:                r.lsb = p->fract2<<12;
                     15:        } else {
                     16:                float f = x;
                     17:                struct f { unsigned sign:1, exp:8, fract:23; }
                     18:                        *p = (struct f *) &f;
                     19:                r.sign = p->sign;
                     20:                r.exp = f ? p->exp - 127 : 0;
                     21:                r.msb = p->fract<<9;
                     22:                r.lsb = 0;
                     23:        }
                     24:        return r;
                     25: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.