/* This C language subroutine seperates the mantissa of a floating point number from its exponent. The Run Time Library for the C Language. Gordon A. Sterling (617) 461 - 3076 DSP Development Tools Engineering Created on 04/25/90 Updated on 6/94 by AS Updated on 1/95 by AS - separated polymorphic functions #include
double frexp(double x, int *exp); */ #include "lib_glob.h" #include "mth_glob.h" .SEGMENT/CODE Code_Space_Name; .FILE RTL_FILENAME; .GLOBAL _frexp; .GLOBAL ___frexpD; _frexp: ___frexpD: frexp_core: reads(R4,1); reads(R8,2); reads(R12,3); R3=BCLR R4 BY 31; /* Clear sign bit */ R0=R3 OR R8, dm_lnt=dm_0; /* Test for zero input */ IF EQ JUMP (PC, restore_state); /* Return zero */ R2=FEXT R4 BY 20:11; /* Get 2*mantissa */ R2=R2+1, R0=R4; /* Increment exponent */ R1=D_EXP_BIAS; R4=R2-R1, dm_ptr=R12; /*Subtract bias */ R1=R1-1, DM(dm_ptr,0)=R4; /*Invert exponent */ R2=0x800FFFFF; R0=R0 AND R2, FETCH_RETURN /*Clear exponent */ R0=R0 OR LSHIFT R1 BY 20; /*Place exponent */ R1=PASS R8; restore_state: RETURN (DB); R1=PASS R8, RESTORE_STACK /* Copy lsw for return */ RESTORE_FRAME return_zero: JUMP (PC, restore_state) (DB); DM(dm_ptr,0)=R0; /* return zero */ FETCH_RETURN .ENDSEG;