dietlibc issue

Hi All,

I am reading dietlibc library written by Dotchland guy , in lib\atoi.c file ,I found the code as (unsigned int)(*s - 9) < 5u , I do not understand why they are there, and what goal of the code? anybody can explain it ? thanks in advance


1
2
3
4
5
6
7
8
9
10
11
12
13
int atoi(const char* s) {
  long int v=0;
  int sign=1;
  while ( *s == ' '  ||  (unsigned int)(*s - 9) < 5u) s++;
  switch (*s) {
  case '-': sign=-1;
  case '+': ++s;
  }
  while ((unsigned int) (*s - '0') < 10u) {
    v=v*10+*s-'0'; ++s;
  }
  return sign==-1?-v:v;
}
Sorry, I got , I just queried Ascill table,
\b = 8
\t = 9
\n =10
\f =12
\r = 13

they are both control char , remove them as space .
Topic archived. No new replies allowed.