Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sources/strtod.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
#endif


#define ISSPACE(c) ((c) == ' ' || (c) == '\t')
#define ISSPACE(c) (((c) == ' ') || ((c) == '\t') || ((c == '\n')) || ((c) == '\r') || ((c) == '\v'))
#define ISDIGIT(c) ((c) >= '0' && (c) <= '9')


Expand Down
18 changes: 9 additions & 9 deletions sources/strtoul_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <stdlib.h>
#include "lib.h"

#define ISSPACE(c) ((c) == ' '||(c) == '\t')
#define ISSPACE(c) (((c) == ' ') || ((c) == '\t') || ((c == '\n')) || ((c) == '\r') || ((c) == '\v'))
#define ISDIGIT(c) ((c) >= '0' && (c) <= '9')

static inline
Expand All @@ -14,7 +14,7 @@ unsigned long __mul32 (long in, long mul, char *overflow) {
".loop: \n" /* } */
" lsr.l #1, %3 \n" /* mul >>= 1 */
" beq .end \n" /* if (mul == 0) goto end; */

" add.l %2, %2 \n" /* in <<= 1; */
" bcs .overfl \n" /* overflow? goto overfl; */
".start: \n"
Expand Down Expand Up @@ -50,18 +50,18 @@ unsigned long __strtoul_internal(const char *nptr, char **endptr, int base, int
int val;
short ret_ok=0;
char overflow=0;

if(base!=0 && 2 > base && base > 36)
goto error;

while(*ptr && ISSPACE(*ptr)) ptr++; /* skip spaces */

if( (*sign = (*ptr == '-')) )
ptr++;

if(!*ptr)
goto error;

if(*ptr == '0') {
ret_ok = 1;
switch (*++ptr&~0x20) {
Expand All @@ -76,19 +76,19 @@ unsigned long __strtoul_internal(const char *nptr, char **endptr, int base, int
ptr++;
break;
default:
if(base == 0)
if(base == 0)
base = 8;
break;
}
} else if(base == 0)
base = 10;

for( ;*ptr; ptr++) {
if(ISDIGIT(*ptr))
if(ISDIGIT(*ptr))
val = *ptr - '0';
else {
val = 10 + (*ptr&~0x20 /*TOUPPER*/) - 'A';
if(val < 10) val = 37;
if(val < 10) val = 37;
}
ret_ok = 1;
if(val >= base) break;
Expand Down
18 changes: 9 additions & 9 deletions sources/strtoull_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# endif


#define ISSPACE(c) ((c) == ' '||(c) == '\t')
#define ISSPACE(c) (((c) == ' ') || ((c) == '\t') || ((c == '\n')) || ((c) == '\r') || ((c) == '\v'))
#define ISDIGIT(c) ((c) >= '0' && (c) <= '9')

static inline
Expand All @@ -29,7 +29,7 @@ unsigned long long __mul64 (long long in, long mul, char *overflow) {
".loop: \n" /* } */
" lsr.l #1, %5 \n" /* mul >>= 1 */
" beq .end \n" /* if (mul == 0) goto end; */

" add.l %3, %3 \n" /* in <<= 1; */
" addx.l %4, %4 \n"
" bcs .overfl \n" /* overflow? goto overfl; */
Expand Down Expand Up @@ -70,18 +70,18 @@ unsigned long long __strtoull_internal(const char *nptr, char **endptr, int base
int val;
short ret_ok=0;
char overflow=0;

if(base!=0 && 2 > base && base > 36)
goto error;

while(*ptr && ISSPACE(*ptr)) ptr++; /* skip spaces */

if( (*sign = (*ptr == '-')) )
ptr++;

if(!*ptr)
goto error;

if(*ptr == '0') {
ret_ok = 1;
ptr++;
Expand All @@ -97,19 +97,19 @@ unsigned long long __strtoull_internal(const char *nptr, char **endptr, int base
ptr++;
break;
default:
if(base == 0)
if(base == 0)
base = 8;
break;
}
} else if(base == 0)
base = 10;

for( ;*ptr; ptr++) {
if(ISDIGIT(*ptr))
if(ISDIGIT(*ptr))
val = *ptr - '0';
else {
val = 10 + (*ptr&~0x20 /*TOUPPER*/) - 'A';
if(val < 10) val = 37;
if(val < 10) val = 37;
}
ret_ok = 1;

Expand Down
Loading