mirror of
git://git.musl-libc.org/musl
synced 2025-03-06 20:48:29 +01:00
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.
This commit is contained in:
parent
54222d1efc
commit
26832d045f
1 changed files with 4 additions and 20 deletions
|
@ -3,23 +3,7 @@
|
|||
void __shlim(FILE *, off_t);
|
||||
int __shgetc(FILE *);
|
||||
|
||||
static inline off_t shcnt(FILE *f)
|
||||
{
|
||||
return f->shcnt + (f->rpos - f->rend);
|
||||
}
|
||||
|
||||
static inline void shlim(FILE *f, off_t lim)
|
||||
{
|
||||
__shlim(f, lim);
|
||||
}
|
||||
|
||||
static inline int shgetc(FILE *f)
|
||||
{
|
||||
if (f->rpos < f->shend) return *f->rpos++;
|
||||
return __shgetc(f);
|
||||
}
|
||||
|
||||
static inline void shunget(FILE *f)
|
||||
{
|
||||
if (f->rend) f->rpos--;
|
||||
}
|
||||
#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))
|
||||
#define shunget(f) ((f)->rend ? (void)(f)->rpos-- : (void)0)
|
||||
|
|
Loading…
Add table
Reference in a new issue