/ ldexp.s (emx+gcc) -- Copyright (c) 1991-1996 by Eberhard Mattes

#include <emx/asm386.h>

#define FUNC    MATHSUFFIX1(ldexp)

        .globl  LABEL(FUNC)

        .text

        ALIGN

/ double ldexp (double x, int exp)

#define x        4(%esp)
#if defined (LONG_DOUBLE)
#define exp     16(%esp)
#else
#define exp     12(%esp)
#endif

LABEL(FUNC):
        PROFILE_NOFRAME
        fildl   exp                     /* exp */
        FLD     x                       /* x */
        fscale
        fstp    %st(1)
        CONV(x)                         /* convert to double */
        _xam
        j_inf   Lerror
Lreturn:EPILOGUE(FUNC)

        ALIGN
Lerror: SET_ERRNO_CONST($ERANGE)
        jmp     Lreturn
