Last change
on this file since 4aa78b2 was b28a12e, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Zero redundant declarations.
|
-
Property mode
set to
100644
|
File size:
519 bytes
|
Line | |
---|
1 | /*
|
---|
2 | =============================================================================
|
---|
3 | atol.c -- ascii to long conversion
|
---|
4 | Version 3 -- 1987-06-29 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "ram.h"
|
---|
9 |
|
---|
10 | int32_t atol(int8_t *cp)
|
---|
11 | {
|
---|
12 | register int32_t n;
|
---|
13 | register int16_t sign;
|
---|
14 |
|
---|
15 | sign = 0;
|
---|
16 |
|
---|
17 | if (*cp EQ '-') {
|
---|
18 |
|
---|
19 | ++cp;
|
---|
20 | sign = 1;
|
---|
21 |
|
---|
22 | } else {
|
---|
23 |
|
---|
24 | if (*cp EQ '+')
|
---|
25 | ++cp;
|
---|
26 | }
|
---|
27 |
|
---|
28 | for (n = 0; isdigit(*cp); )
|
---|
29 | n = n * 10 + *cp++ - '0';
|
---|
30 |
|
---|
31 | return(sign ? -n : n);
|
---|
32 | }
|
---|
33 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.