Annotation of coherent/b/lib/libc/crt/i386/ldexp.s, revision 1.1

1.1     ! root        1: //////////
        !             2: / libc/crt/i386/ldexp.s
        !             3: / i386 C runtime library.
        !             4: / IEEE software floating point support.
        !             5: / i8086 IEEE software floating point library.
        !             6: / ldexp()
        !             7: //////////
        !             8: 
        !             9: //////////
        !            10: / double
        !            11: / ldexp(dbl, exp) double dbl; int exp;
        !            12: /
        !            13: / Returns dbl * 2^^exp.
        !            14: //////////
        !            15: 
        !            16:        .globl  ldexp
        !            17: 
        !            18: dbl    .equ    4
        !            19: exp    .equ    dbl+8
        !            20: EXPMASK        .equ    0x7FF00000
        !            21: SGNMASK        .equ    0x80000000
        !            22: MAXEXP .equ    2047
        !            23: 
        !            24: ldexp:
        !            25:        movl    %ecx, dbl+4(%esp)               / high word of dbl to ECX
        !            26:        movl    %edx, $EXPMASK
        !            27:        andl    %edx, %ecx                      / shifted exponent to EDX
        !            28:        xorl    %ecx, %edx                      / mask off exponent in ECX
        !            29:        shrl    %edx, $20                       / exponent in EDX
        !            30:        addl    %edx, exp(%esp)                 / bump by exp
        !            31:        jle     ?underflow
        !            32:        cmpl    %edx, $MAXEXP
        !            33:        jge     ?overflow
        !            34:        shll    %edx, $20
        !            35:        orl     %edx, %ecx                      / hi mantissa bits to EDX
        !            36:        movl    %eax, dbl(%esp)                 / lo manitssa dword to EAX
        !            37:        ret
        !            38: 
        !            39: ?underflow:
        !            40:        andl    %ecx, $SGNMASK                  / preserve sign
        !            41:        jmp     ?done
        !            42: 
        !            43: ?overflow:
        !            44:        andl    %ecx, $SGNMASK                  / preserve sign
        !            45:        orl     %ecx, $EXPMASK                  / max exponent
        !            46: ?done:
        !            47:        movl    %edx, %ecx                      / sign/exp to EDX
        !            48:        subl    %eax, %eax                      / 0 lo mantissa to EAX
        !            49:        ret
        !            50: 
        !            51: / end of libc/crt/i386/ldexp.s

unix.superglobalmegacorp.com

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