From 2fdc7c2c6094f478f2a7d192f0794195a10a7f2c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 31 Oct 2018 15:53:11 +0100 Subject: [PATCH] Use ALWAYS_INLINE for ctype inlines. --- LibC/ctype.h | 19 +++++++++++++------ 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 + +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 }