~ubuntu-branches/ubuntu/gutsy/avr-libc/gutsy

« back to all changes in this revision

Viewing changes to libm/fplib/strtod.S

  • Committer: Bazaar Package Importer
  • Author(s): Hakan Ardo
  • Date: 2006-05-01 12:03:39 UTC
  • mto: (3.1.1 edgy)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20060501120339-q93dxulpunby36dj
Tags: upstream-1.4.4
ImportĀ upstreamĀ versionĀ 1.4.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*  -*- Mode: Asm -*-  */
2
2
 
3
 
/* Copyright (c) 2002  Michael Stumpf  <mistumpf@de.pepperl-fuchs.com>
 
3
/* Copyright (c) 2002-2005  Michael Stumpf  <mistumpf@de.pepperl-fuchs.com>
4
4
   All rights reserved.
5
5
 
6
6
 
32
32
   POSSIBILITY OF SUCH DAMAGE. 
33
33
*/
34
34
 
 
35
/* $Id: strtod.S,v 1.10 2005/09/13 13:29:54 joerg_wunsch Exp $ */
 
36
 
35
37
/*
36
38
    strtod.S is an addition to     FPlib V 0.3.0       ported to avr-as
37
39
    for details see readme.strtod
41
43
 *----------------------------------------------------------------------------------------------
42
44
 */
43
45
 
44
 
#if !defined(DOXYGEN)
 
46
#if !defined(__DOXYGEN__)
45
47
 
46
48
#include "gasava.inc"
 
49
#include "macros.inc"
47
50
#include "fplib.inc"
48
51
 
49
52
#define rFlags   rSI0  /*  */
285
288
        BRLT    10f
286
289
        BRNE    2f              ; look for leading zeros
287
290
        SBRS    rFlags,bitDigit
288
 
        RJMP    4f              ; no valid digits yet -> skip zero
 
291
        RJMP    3f              ; no valid digits yet -> skip zero
289
292
2:
290
293
        CPI     rCh,'9'+1
291
294
        BRGE    10f             ; no digit, no integer part
300
303
3:
301
304
        MOV     rEndptrH,YH
302
305
        MOV     rEndptrL,YL     ; valid exponent up to now
303
 
4:
304
306
        LD      rCh,Y+
305
307
        RJMP    1b
306
308
10:
319
321
        SBRC    rFlags,bitPoint
320
322
        RJMP    10f             ; just found the second point
321
323
        ORI     rFlags,_BV(bitPoint)
 
324
        BRTS    7f              ; no digits yet, then '.' is not valid in it self
322
325
        RJMP    6f
323
326
2:
324
327
        CPI     rCh,'0'
348
351
        adc     rA1,__zero_reg__
349
352
        adc     rA2,__zero_reg__
350
353
        adc     rA3,__zero_reg__
351
 
        MOV     rEndptrH,YH
352
 
        MOV     rEndptrL,YL     ; valid float up to now
353
354
4:
354
355
        SBRC    rFlags,bitPoint
355
 
        ; scan left of decimal point : decrement exponent
 
356
        ; scan after decimal point : decrement exponent
356
357
        DEC     rDPshift
357
358
        RJMP    6f
358
359
5:
359
 
        ; scan vor dem Komma, aber keine Digits mehr auswerten : inkrementiere
 
360
        ; scan before decimal point, but do not use the digits: increment
360
361
        SBRS    rFlags,bitPoint
361
362
        INC     rDPshift
362
363
6:
 
364
        MOV     rEndptrH,YH
 
365
        MOV     rEndptrL,YL     ; valid float up to now
 
366
7:
363
367
        LD      rCh,Y+
364
368
        RJMP    1b
365
369
10:
375
379
        .size strtod, .-strtod
376
380
        ENDFUNC
377
381
 
378
 
#endif /* not DOXYGEN */
 
382
#endif /* not __DOXYGEN__ */