Annotation of 43BSDTahoe/lib/libc/tahoe/fpe/cvtuf.s, revision 1.1

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

unix.superglobalmegacorp.com

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