avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Bug in atoi.S and atol.S


From: Olaf Zenker
Subject: [avr-gcc-list] Bug in atoi.S and atol.S
Date: Wed, 5 Feb 2003 14:42:17 +0100 (MET)

According to the description in the header the conversion should stop at
detection of 
an non numeric character. But if the non numeric character is different from
\0 then 
the minus sign is placed by mistake.

.
.
.
.atol_sig:
 CP  num_lo_lo, __zero_reg__
 CPC  num_lo_hi, __zero_reg__
 CPC  num_hi_lo, __zero_reg__
 CPC  num_hi_hi, __zero_reg__ ; did we get a number?
 BREQ .atol_done            ; no, drop sign and return
 CLR tmp  ; MUST be set to 0 else there would be a  
    ; misinterpretation if the last 
    ; Char isn't "\0"
    ; (Changed by Olaf Zenker)
 BLD  tmp, 0 ; get sign again
 TST  tmp               ; positive number?
 BREQ .atol_done
.
.
.

In order to have a correct conversion the line with the CLR tmp must be
added


Regards
Olaf

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]