Annotation of cci/usr/src/lib/libc/tahoe/gen/cvtuf.x, revision 1.1

1.1     ! root        1: #include       <machine/fp.h>
        !             2: 
        !             3:        .text
        !             4:        .globl  Xcvtuf
        !             5: _cvtuf:
        !             6: Xcvtuf:        .word   0x003c          # we use r2,r3,r4,r5
        !             7: 
        !             8:  #
        !             9:  #     Some initializations:
        !            10:  #
        !            11:        clrl    r1
        !            12:        clrl    r2              # r2 - exponent.
        !            13:        movl    4(fp),r0        # fetch operand.
        !            14:        jeql    retzero         # return zero.
        !            15:  # 
        !            16:  #     Compute exponent:
        !            17:  #
        !            18: positive:
        !            19:        ffs     r0,r1
        !            20:        incl    r1
        !            21:        addl2   r1,r2
        !            22:        shrl    r1,r0,r0
        !            23:        jneq    positive        # look for more set bits.
        !            24:  #
        !            25:  # we have the exponent in r2.
        !            26:  #
        !            27:        movl    4(fp),r0        # r0 will hold the resulting f.p. number.
        !            28:  #
        !            29:  #     Shift the fraction part to its proper place:
        !            30:  #
        !            31:        subl3   r2,$HID_POS,r3
        !            32:        jlss    shiftr          # if less then zero we have to shift right.
        !            33:        shll    r3,r0,r0        # else we shift left.
        !            34:        jmp     shifted
        !            35: shiftr:
        !            36:        mnegl   r3,r3
        !            37:        shrl    r3,r0,r0
        !            38: shifted:
        !            39:        andl2   $CLEARHID,r0    # clear the hidden bit.
        !            40:        shal    $EXPSHIFT,r2,r2 # shift the exponent to its proper place.
        !            41:        orl2    $EXPSIGN,r2     # set the exponent sign bit(to bias it).
        !            42:        orl2    r2,r0           # combine exponent & fraction.
        !            43: sign_ok:
        !            44:        ret
        !            45: 
        !            46: retzero:
        !            47:        clrl    r0
        !            48:        ret
        !            49: 
        !            50:        

unix.superglobalmegacorp.com

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