jacobian

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit c0c5b322018a181d57415988386354a530a47591
parent a03b3cf0975808accfe35094f0e56227d21882ff
Author: David Freifeld <freifeld.david@gmail.com>
Date:   Sun, 20 Sep 2020 23:03:09 -0700

Things work now

Diffstat:
Msrc/experimental/fileread.cpp | 11++++-------
1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/experimental/fileread.cpp b/src/experimental/fileread.cpp @@ -34,12 +34,10 @@ inline float scan(char **p) int neg = 1; while (!isdigit(**p) && **p != '-' && **p != '.') ++*p; if (**p == '-') neg = -1, ++*p; - for (n=0; isdigit(**p); ++*p) - (n *= 10) += (**p-'0'); + for (n=0; isdigit(**p); ++*p) (n *= 10) += (**p-'0'); if (*(*p)++ != '.') return n*neg; float d = 1; - for (; isdigit(**p); ++*p) - n += (d /= 10) * (**p-'0'); + for (; isdigit(**p); ++*p) n += (d /= 10) * (**p-'0'); return n*neg; } @@ -66,14 +64,13 @@ int main () { return 1; } if (!bytes_read) break; - for(char *p = buf; /* unreadable! */;) { - printf("test: %s\n", buf); + for(char *p = buf;;) { char* bound = (char*) memchr(p, '\n', (buf + bytes_read) - p); if (bound - p < 0) break; // Stop. for (int i=0; i<5; ++i) { tmp = scan(&p); - printf("bound - p = %ld\n", bound-p); } + p = bound + 1; ++lines; } bufs++;