mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
Use ALWAYS_INLINE for ctype inlines.
This commit is contained in:
parent
71c9b09e8c
commit
2fdc7c2c60
Notes:
sideshowbarker
2024-07-19 18:35:51 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/2fdc7c2c609
2 changed files with 15 additions and 6 deletions
19
LibC/ctype.h
19
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';
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#define ALWAYS_INLINE inline __attribute__ ((always_inline))
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define __BEGIN_DECLS extern "C" {
|
||||
#define __END_DECLS }
|
||||
|
|
Loading…
Add table
Reference in a new issue