Last change
on this file since 352 was 352, checked in by coas-nagasima, 6 years ago |
arm向けASP3版ECNLを追加
|
-
Property svn:eol-style
set to
native
-
Property svn:mime-type
set to
text/x-csrc;charset=UTF-8
|
File size:
857 bytes
|
Rev | Line | |
---|
[352] | 1 | #include <stdlib.h>
|
---|
| 2 | #include "shgetc.h"
|
---|
| 3 | #include "floatscan.h"
|
---|
| 4 | #include "stdio_impl.h"
|
---|
| 5 | #include "libc.h"
|
---|
| 6 |
|
---|
| 7 | static long double strtox(const char *s, char **p, int prec)
|
---|
| 8 | {
|
---|
| 9 | FILE f = {
|
---|
| 10 | .buf = (void *)s, .rpos = (void *)s,
|
---|
| 11 | .rend = (void *)-1, .lock = -1
|
---|
| 12 | };
|
---|
| 13 | shlim(&f, 0);
|
---|
| 14 | long double y = __floatscan(&f, prec, 1);
|
---|
| 15 | off_t cnt = shcnt(&f);
|
---|
| 16 | if (p) *p = cnt ? (char *)s + cnt : (char *)s;
|
---|
| 17 | return y;
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | float strtof(const char *restrict s, char **restrict p)
|
---|
| 21 | {
|
---|
| 22 | return strtox(s, p, 0);
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | double strtod(const char *restrict s, char **restrict p)
|
---|
| 26 | {
|
---|
| 27 | return strtox(s, p, 1);
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | long double strtold(const char *restrict s, char **restrict p)
|
---|
| 31 | {
|
---|
| 32 | return strtox(s, p, 2);
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 | weak_alias(strtof, strtof_l);
|
---|
| 36 | weak_alias(strtod, strtod_l);
|
---|
| 37 | weak_alias(strtold, strtold_l);
|
---|
| 38 | weak_alias(strtof, __strtof_l);
|
---|
| 39 | weak_alias(strtod, __strtod_l);
|
---|
| 40 | weak_alias(strtold, __strtold_l);
|
---|
Note:
See
TracBrowser
for help on using the repository browser.