diff options
Diffstat (limited to 'src/nvim/ascii.h')
-rw-r--r-- | src/nvim/ascii.h | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/src/nvim/ascii.h b/src/nvim/ascii.h index 2b3e94d5a0..44ff540b40 100644 --- a/src/nvim/ascii.h +++ b/src/nvim/ascii.h @@ -85,10 +85,25 @@ # define PATHSEPSTR "/" #endif -static inline bool ascii_iswhite(int) REAL_FATTR_ALWAYS_INLINE REAL_FATTR_CONST; -static inline bool ascii_isdigit(int) REAL_FATTR_ALWAYS_INLINE REAL_FATTR_CONST; -static inline bool ascii_isxdigit(int) REAL_FATTR_ALWAYS_INLINE REAL_FATTR_CONST; -static inline bool ascii_isspace(int) REAL_FATTR_ALWAYS_INLINE REAL_FATTR_CONST; +static inline bool ascii_iswhite(int) + REAL_FATTR_CONST + REAL_FATTR_ALWAYS_INLINE; + +static inline bool ascii_isdigit(int) + REAL_FATTR_CONST + REAL_FATTR_ALWAYS_INLINE; + +static inline bool ascii_isxdigit(int) + REAL_FATTR_CONST + REAL_FATTR_ALWAYS_INLINE; + +static inline bool ascii_isbdigit(int) + REAL_FATTR_CONST + REAL_FATTR_ALWAYS_INLINE; + +static inline bool ascii_isspace(int) + REAL_FATTR_CONST + REAL_FATTR_ALWAYS_INLINE; /// Checks if `c` is a space or tab character. /// @@ -122,6 +137,14 @@ static inline bool ascii_isxdigit(int c) || (c >= 'A' && c <= 'F'); } +/// Checks if `c` is a binary digit, that is, 0-1. +/// +/// @see {ascii_isdigit} +static inline bool ascii_isbdigit(int c) +{ + return (c == '0' || c == '1'); +} + /// Checks if `c` is a white-space character, that is, /// one of \f, \n, \r, \t, \v. /// |