mit-pdos / xv6-riscv

Xv6 for RISC-V
Other
6.6k stars 2.38k forks source link

atoi() modified to work with positive and negative numbers #140

Open HeberDamianAlturria opened 1 year ago

HeberDamianAlturria commented 1 year ago

To whom it may concern, my name is Heber Damián Alturria and i have noticed that atoi() only return 0 when we pass as input a string that represent a negative number such as "-1" or if it have a positive sign such as "+1". To solve the aforementioned situation, i have modified the implementation of atoi() to permit the use of positive and negative signs, resulting in results as interesting as:

As you can appreciate, the operation of the atoi() that I have modified is similar to the atoi() provided by the C library called stdlib.h.

thank you very much for reading and I hope you will consider adding the modification I have provided to the atoi().

best regards.