Diff

Differences From Artifact [a2ea6970d9]:

To Artifact [7e64c39e73]:


1
2
3
4
5
6
7
8

9
10
11

12
13

















14
15



16
17
18
19
20
21
22
1
2
3
4
5
6
7

8
9
10
11
12
13

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42







-
+



+

-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+


+
+
+







#include <sys/types.h>
#include <stdlib.h>
#include <limits.h>
#include <ctype.h>
#include <stdio.h>

/* We only handle base 10. */
unsigned long long int strtoull(const char *nptr, char **endptr, int base) {
long long int strtoull(const char *nptr, char **endptr, int base) {
	unsigned long long int retval = 0;
	const char **endptrd = (const char **) endptr;
	char *idx = NULL;
	int allowspace = 1;

	for (idx = nptr; *idx != '\0' && isdigit(*idx); idx++) {
	idx = nptr;
	while (1) {
		if (*idx == '\0') {
			break;
		}

		if (!isdigit(*idx)) {
			if (*idx == '-') {
				retval *= -1;
				continue;
			}
			if ((*idx == ' ' || *idx == '\t') && allowspace) {
				continue
			}
			break;
		}

		retval *= 10;
		retval += (*idx - '0');

		allowspace = 0;
		idx++;
	}

	if (endptrd != NULL) {
		*endptrd = idx;
	}

	return(retval);