Logo
Explore Help
Sign In
fluencelabs/musl
1
0
Fork 0
You've already forked musl
mirror of https://github.com/fluencelabs/musl synced 2025-06-06 19:41:34 +00:00
Code Issues Projects Releases Wiki Activity
musl/src/internal/shgetc.h

10 lines
311 B
C
Raw Normal View History

add "scan helper getc" and rework strtod, etc. to use it the immediate benefit is a significant debloating of the float parsing code by moving the responsibility for keeping track of the number of characters read to a different module. by linking shgetc with the stdio buffer logic, counting logic is defered to buffer refill time, keeping the calls to shgetc fast and light. in the future, shgetc will also be useful for integrating the new float code with scanf, which needs to not only count the characters consumed, but also limit the number of characters read based on field width specifiers. shgetc may also become a useful tool for simplifying the integer parsing code.
2012-04-10 21:47:37 -04:00
#include "stdio_impl.h"
void __shlim(FILE *, off_t);
int __shgetc(FILE *);
use macros instead of inline functions in shgetc.h at -Os optimization level, gcc refuses to inline these functions even though the inlined code would roughly the same size as the function call, and much faster. the easy solution is to make them into macros.
2012-04-13 03:59:36 -04:00
#define shcnt(f) ((f)->shcnt + ((f)->rpos - (f)->rend))
#define shlim(f, lim) __shlim((f), (lim))
#define shgetc(f) (((f)->rpos < (f)->shend) ? *(f)->rpos++ : __shgetc(f))
fix broken shgetc limiter logic (wasn't working)
2012-04-16 01:55:37 -04:00
#define shunget(f) ((f)->shend ? (void)(f)->rpos-- : (void)0)
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.8 Page: 68ms Template: 3ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API