Hex numbers didn't work. Corrected bug in myatoi().
This commit is contained in:
parent
d112eb710c
commit
ef48465b2a
|
@ -319,7 +319,7 @@ int myatoi(s) register char *s; {
|
||||||
case 'e':
|
case 'e':
|
||||||
case 'f':
|
case 'f':
|
||||||
if (base!=16) error("Hexletter in number not expected");
|
if (base!=16) error("Hexletter in number not expected");
|
||||||
sum = sum*base + *s++ - 'a';
|
sum = sum*base + 10 + *s++ - 'a';
|
||||||
break;
|
break;
|
||||||
case 'A':
|
case 'A':
|
||||||
case 'B':
|
case 'B':
|
||||||
|
@ -328,7 +328,7 @@ int myatoi(s) register char *s; {
|
||||||
case 'E':
|
case 'E':
|
||||||
case 'F':
|
case 'F':
|
||||||
if (base!=16) error("Hexletter in number not expected");
|
if (base!=16) error("Hexletter in number not expected");
|
||||||
sum = sum*base + *s++ - 'A';
|
sum = sum*base + 10 + *s++ - 'A';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue