Annotation of researchv10no/cmd/lcc/gen2/vax/decode.c, revision 1.1

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

unix.superglobalmegacorp.com

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