mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 10:37:45 +00:00
Use modern C++ attributes instead of __attribute__ voodoo.
This is quite nice, although I wish [[gnu::always_inline]] implied inline. Also "gnu::" is kind of a wart, but whatcha gonna do.
This commit is contained in:
parent
fbcc8ab840
commit
022f7790db
34 changed files with 99 additions and 124 deletions
14
LibC/ctype.h
14
LibC/ctype.h
|
@ -4,41 +4,41 @@
|
|||
|
||||
__BEGIN_DECLS
|
||||
|
||||
ALWAYS_INLINE int isascii(int ch)
|
||||
[[gnu::always_inline]] inline int isascii(int ch)
|
||||
{
|
||||
return (ch & ~0x7f) == 0;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE int isspace(int ch)
|
||||
[[gnu::always_inline]] inline int isspace(int ch)
|
||||
{
|
||||
return ch == ' ' || ch == '\f' || ch == '\n' || ch == '\r' || ch == '\t' || ch == '\v';
|
||||
}
|
||||
|
||||
ALWAYS_INLINE int islower(int c)
|
||||
[[gnu::always_inline]] inline int islower(int c)
|
||||
{
|
||||
return c >= 'a' && c <= 'z';
|
||||
}
|
||||
|
||||
ALWAYS_INLINE int isupper(int c)
|
||||
[[gnu::always_inline]] inline int isupper(int c)
|
||||
{
|
||||
return c >= 'A' && c <= 'Z';
|
||||
}
|
||||
|
||||
ALWAYS_INLINE int tolower(int c)
|
||||
[[gnu::always_inline]] inline int tolower(int c)
|
||||
{
|
||||
if (isupper(c))
|
||||
return c | 0x20;
|
||||
return c;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE int toupper(int c)
|
||||
[[gnu::always_inline]] inline int toupper(int c)
|
||||
{
|
||||
if (islower(c))
|
||||
return c & ~0x20;
|
||||
return c;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE int isdigit(int c)
|
||||
[[gnu::always_inline]] inline int isdigit(int c)
|
||||
{
|
||||
return c >= '0' && c <= '9';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue