diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-01-20 23:46:31 -0500 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-01-21 01:34:36 -0500 |
commit | 9eb6a4456491c1b4dec8c1ff07c4b33220c3bab2 (patch) | |
tree | e357cc3ea0bf85d9977f6f43ee8e77a75790480f /src/nvim/ascii.h | |
parent | 03d8adda8e5101538893d8b7ddf547273bb4a26e (diff) | |
parent | f82e982bda49d15f19dbd72531a6c1125d863486 (diff) | |
download | rneovim-9eb6a4456491c1b4dec8c1ff07c4b33220c3bab2.tar.gz rneovim-9eb6a4456491c1b4dec8c1ff07c4b33220c3bab2.tar.bz2 rneovim-9eb6a4456491c1b4dec8c1ff07c4b33220c3bab2.zip |
Merge #3916 "Add support for binary numbers".
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. /// |