diff options
author | Andreas Kling <awesomekling@gmail.com> | 2018-10-31 15:53:11 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2018-10-31 15:53:11 +0100 |
commit | 2fdc7c2c6094f478f2a7d192f0794195a10a7f2c (patch) | |
tree | 4bd83decbf1b1e46be330d064885b815bf2af25f | |
parent | 71c9b09e8c698da0964e104fb4aec4c591b731e4 (diff) | |
download | serenity-2fdc7c2c6094f478f2a7d192f0794195a10a7f2c.zip |
Use ALWAYS_INLINE for ctype inlines.
-rw-r--r-- | LibC/ctype.h | 19 | ||||
-rw-r--r-- | LibC/sys/cdefs.h | 2 |
2 files changed, 15 insertions, 6 deletions
diff --git a/LibC/ctype.h b/LibC/ctype.h index 961881ceca..7d9f437aa4 100644 --- a/LibC/ctype.h +++ b/LibC/ctype.h @@ -1,35 +1,42 @@ #pragma once -inline int isascii(int ch) +#include <sys/cdefs.h> + +ALWAYS_INLINE int isascii(int ch) { return (ch & ~0x7f) == 0; } -inline int isspace(int ch) +ALWAYS_INLINE int isspace(int ch) { return ch == ' ' || ch == '\f' || ch == '\n' || ch == '\r' || ch == '\t' == '\v'; } -inline int islower(int c) +ALWAYS_INLINE int islower(int c) { return c >= 'a' && c <= 'z'; } -inline int isupper(int c) +ALWAYS_INLINE int isupper(int c) { return c >= 'A' && c <= 'Z'; } -inline int tolower(int c) +ALWAYS_INLINE int tolower(int c) { if (isupper(c)) return c | 0x20; return c; } -inline int toupper(int c) +ALWAYS_INLINE int toupper(int c) { if (islower(c)) return c & ~0x20; return c; } + +ALWAYS_INLINE int isdigit(int c) +{ + return c >= '0' && c <= '9'; +} diff --git a/LibC/sys/cdefs.h b/LibC/sys/cdefs.h index c2285b88a8..68f4045e31 100644 --- a/LibC/sys/cdefs.h +++ b/LibC/sys/cdefs.h @@ -1,5 +1,7 @@ #pragma once +#define ALWAYS_INLINE inline __attribute__ ((always_inline)) + #ifdef __cplusplus #define __BEGIN_DECLS extern "C" { #define __END_DECLS } |