Annotation of 43BSD/lib/libc/vax/gen/ldexp.s, revision 1.1

1.1     ! root        1: #ifdef LIBC_SCCS
        !             2:        .asciz  "@(#)ldexp.s    5.2 (Berkeley) 3/9/86"
        !             3: #endif LIBC_SCCS
        !             4: 
        !             5: /*
        !             6:  * double ldexp (value, exp)
        !             7:  * double value;
        !             8:  * int exp;
        !             9:  *
        !            10:  * Ldexp returns value*2**exp, if that result is in range.
        !            11:  * If underflow occurs, it returns zero.  If overflow occurs,
        !            12:  * it returns a value of appropriate sign and largest
        !            13:  * possible magnitude.  In case of either overflow or underflow,
        !            14:  * errno is set to ERANGE.  Note that errno is not modified if
        !            15:  * no error occurs.
        !            16:  */
        !            17: 
        !            18: #include "DEFS.h"
        !            19: #include <errno.h>
        !            20: 
        !            21:        .globl  _errno
        !            22: 
        !            23: ENTRY(ldexp, 0)
        !            24:        movd    4(ap),r0        /* fetch "value" */
        !            25:        extzv   $7,$8,r0,r2     /* r2 := biased exponent */
        !            26:        jeql    1f              /* if zero, done */
        !            27: 
        !            28:        addl2   12(ap),r2       /* r2 := new biased exponent */
        !            29:        jleq    2f              /* if <= 0, underflow */
        !            30:        cmpl    r2,$256         /* otherwise check if too big */
        !            31:        jgeq    3f              /* jump if overflow */
        !            32:        insv    r2,$7,$8,r0     /* put exponent back in result */
        !            33: 1:
        !            34:        ret
        !            35: 2:
        !            36:        clrd    r0
        !            37:        jbr     1f
        !            38: 3:
        !            39:        movd    huge,r0         /* largest possible floating magnitude */
        !            40:        jbc     $15,4(ap),1f    /* jump if argument was positive */
        !            41:        mnegd   r0,r0           /* if arg < 0, make result negative */
        !            42: 1:
        !            43:        movl    $ERANGE,_errno
        !            44:        ret
        !            45: 
        !            46:        .data
        !            47: huge:  .word   0x7fff          /* the largest number that can */
        !            48:        .word   0xffff          /*   be represented in a long floating */
        !            49:        .word   0xffff          /*   number.  This is given in hex in order */
        !            50:        .word   0xffff          /*   to avoid floating conversions */

unix.superglobalmegacorp.com

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