Annotation of 43BSDReno/sys/tahoemath/Kcvtdl.s, revision 1.1.1.1

1.1       root        1: /*     Kcvtdl.s        1.3     86/01/05        */
                      2: 
                      3: #include "../tahoemath/fp.h"
                      4: #include "../tahoemath/Kfp.h"
                      5: #include "../tahoe/SYS.h"
                      6: 
                      7:  
                      8:        .text
                      9:        .globl  _Kcvtdl
                     10:        .globl  _Kcvtdu
                     11: _Kcvtdu:
                     12: _Kcvtdl:
                     13:        .word   R5|R4|R3|R2
                     14: 
                     15:  #
                     16:  #Some initializations:
                     17:  #
                     18:        clrl    r3              # r3 - negative flag.
                     19:        movl    4(fp),r0        # fetch operand.
                     20:        movl    8(fp),r1        
                     21:  #
                     22:  #get exponent
                     23:  #
                     24:        andl3   $EXPMASK,r0,r2  # r2 will hold the exponent.
                     25:        jeql    retzero 
                     26:        cmpl    $TWO_EXP,r2     # if exponent is less then -2,return zero.
                     27:        jgtr    retzero
                     28:        andl2   $0!EXPSIGN,r2   # turn off biased exponent sign
                     29:        shrl    $EXPSHIFT,r2,r2
                     30:  #
                     31:  #get fraction
                     32:  #
                     33:        bbc     $31,r0,positive # if negative remember it.
                     34:        incl    r3
                     35: positive:
                     36:                                # clear the non fraction parts.
                     37:        andl2   $(0!(EXPMASK | SIGNBIT)),r0
                     38:                                # add the hidden bit.
                     39:        orl2    $(0!CLEARHID),r0
                     40:        subl2   $24,r2          # compute the shift.
                     41:        jgtr    shift_left
                     42:        mnegl   r2,r2
                     43:        shrl    r2,r0,r0        # shift right.
                     44:        jmp     shifted
                     45: shift_left:
                     46:        cmpl    r2,$7
                     47:        jgtr    overflow
                     48: go_on: shlq    r2,r0,r0        # shift right.
                     49: shifted:
                     50:        bbc     $0,r3,done      # check for negative
                     51:        mnegl   r0,r0
                     52: done:  
                     53:        ret
                     54: 
                     55: retzero:
                     56:        clrl    r0
                     57:        ret
                     58: overflow:
                     59:        ret

unix.superglobalmegacorp.com

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