1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:57:34 +00:00

Use ALWAYS_INLINE for ctype inlines.

This commit is contained in:
Andreas Kling 2018-10-31 15:53:11 +01:00
parent 71c9b09e8c
commit 2fdc7c2c60
2 changed files with 15 additions and 6 deletions

View file

@ -1,35 +1,42 @@
#pragma once #pragma once
inline int isascii(int ch) #include <sys/cdefs.h>
ALWAYS_INLINE int isascii(int ch)
{ {
return (ch & ~0x7f) == 0; 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'; 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'; return c >= 'a' && c <= 'z';
} }
inline int isupper(int c) ALWAYS_INLINE int isupper(int c)
{ {
return c >= 'A' && c <= 'Z'; return c >= 'A' && c <= 'Z';
} }
inline int tolower(int c) ALWAYS_INLINE int tolower(int c)
{ {
if (isupper(c)) if (isupper(c))
return c | 0x20; return c | 0x20;
return c; return c;
} }
inline int toupper(int c) ALWAYS_INLINE int toupper(int c)
{ {
if (islower(c)) if (islower(c))
return c & ~0x20; return c & ~0x20;
return c; return c;
} }
ALWAYS_INLINE int isdigit(int c)
{
return c >= '0' && c <= '9';
}

View file

@ -1,5 +1,7 @@
#pragma once #pragma once
#define ALWAYS_INLINE inline __attribute__ ((always_inline))
#ifdef __cplusplus #ifdef __cplusplus
#define __BEGIN_DECLS extern "C" { #define __BEGIN_DECLS extern "C" {
#define __END_DECLS } #define __END_DECLS }