source: trunk/sys/dietlibc/atoll.c @ 1

Last change on this file since 1 was 1, checked in by alain, 5 years ago

First import

File size: 375 bytes
Line 
1#include <endian.h>
2#include <ctype.h>
3#include <stdlib.h>
4
5#if __WORDSIZE != 64
6long long int atoll(const char* s) {
7  long long int v=0;
8  int sign=1;
9  while ( *s == ' '  ||  (unsigned int)(*s - 9) < 5u) ++s;
10  switch (*s) {
11  case '-': sign=-1;
12  case '+': ++s;
13  }
14  while ((unsigned int) (*s - '0') < 10u) {
15    v=v*10+*s-'0'; ++s;
16  }
17  return sign==-1?-v:v;
18}
19#endif
Note: See TracBrowser for help on using the repository browser.