/[avr-libc]/avr-libc/libm/fplib/fp_split.S
ViewVC logotype

Diff of /avr-libc/libm/fplib/fp_split.S

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by aesok, Sun Nov 13 20:59:24 2005 UTC revision 1.8.2.1 by aesok, Mon Dec 5 22:06:55 2005 UTC
# Line 1  Line 1 
1  /*  -*- Mode: Asm -*-  */  /*  -*- Mode: Asm -*-  */
2    
3  /* Copyright (c) 2002  Michael Stumpf  <mistumpf@de.pepperl-fuchs.com>  /* Copyright (c) 2002  Michael Stumpf  <mistumpf@de.pepperl-fuchs.com>
4       Copyright (c) 2005  Anatoly Sokolov <aesok@post.ru>
5     All rights reserved.     All rights reserved.
6    
7    
# Line 98  GLOBAL(__fp_split1) Line 99  GLOBAL(__fp_split1)
99    
100            ENDFUNC            ENDFUNC
101    
102    /*
103     *----------------------------------------------------------------------------------------------
104     * split up in sign : exp : fraction   : fraction extention
105     *          x  T    : rA3 : rA2:rA1:rA0: rAE
106     *
107     * if defined FPLIB_CHECK_FOR_NAN
108     * does not return to calling function in case of NaN !
109     * -> call fp_split before pushing locals to stack!!!
110     *
111     */
112    
113            FUNCTION(__fp_split_a)
114    
115    GLOBAL(__fp_split_a)
116            BST     rA3, 7          ; T = sign
117            
118            ADD     rA2, rA2        ; MSB of exponent to carry
119            adc     rA3, rA3        ; whole exponent in rA3, sign in C
120            CPI     rA3, 0xFF       ; if no jump then C as hidden one is set
121            BREQ    .L_fp_split_a_nan
122            CLR     rAE             ; clear fraction extension
123            CP      rAE, rA3        ; set C if nonzero exponent.  
124            BRCS    1f
125            LDI     rA3, 1          ; zero exponent really means 1 with hidden bit = 0
126    1:
127            ROR     rA2             ; sets hidden bit
128            RET
129            
130    .L_fp_split_a_nan:
131            POP     rA3
132            POP     rA3             ; pop return adress
133     #ifdef __ERRNO__
134            LDI     rA3, EDOM       ; NaN is argument domain error !
135     #endif
136            CLR     r1
137            RJMP    _U(__fp_nan)
138    
139            ENDFUNC
140    
141    
142  #endif /* not __DOXYGEN__ */  #endif /* not __DOXYGEN__ */

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.8.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26