Commit 8c495b5b by Abseil Team Committed by Copybara-Service

Mark inline functions with only a simple comparison in strings/ascii.h as constexpr.

PiperOrigin-RevId: 686814718
Change-Id: Ia712f4cd24ebf3d02fd0b03cd6973bb53e128682
parent 202a8f40
......@@ -139,32 +139,42 @@ inline bool ascii_isxdigit(unsigned char c) {
//
// Determines whether the given character can be represented as a decimal
// digit character (i.e. {0-9}).
inline bool ascii_isdigit(unsigned char c) { return c >= '0' && c <= '9'; }
inline constexpr bool ascii_isdigit(unsigned char c) {
return c >= '0' && c <= '9';
}
// ascii_isprint()
//
// Determines whether the given character is printable, including spaces.
inline bool ascii_isprint(unsigned char c) { return c >= 32 && c < 127; }
inline constexpr bool ascii_isprint(unsigned char c) {
return c >= 32 && c < 127;
}
// ascii_isgraph()
//
// Determines whether the given character has a graphical representation.
inline bool ascii_isgraph(unsigned char c) { return c > 32 && c < 127; }
inline constexpr bool ascii_isgraph(unsigned char c) {
return c > 32 && c < 127;
}
// ascii_isupper()
//
// Determines whether the given character is uppercase.
inline bool ascii_isupper(unsigned char c) { return c >= 'A' && c <= 'Z'; }
inline constexpr bool ascii_isupper(unsigned char c) {
return c >= 'A' && c <= 'Z';
}
// ascii_islower()
//
// Determines whether the given character is lowercase.
inline bool ascii_islower(unsigned char c) { return c >= 'a' && c <= 'z'; }
inline constexpr bool ascii_islower(unsigned char c) {
return c >= 'a' && c <= 'z';
}
// ascii_isascii()
//
// Determines whether the given character is ASCII.
inline bool ascii_isascii(unsigned char c) { return c < 128; }
inline constexpr bool ascii_isascii(unsigned char c) { return c < 128; }
// ascii_tolower()
//
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment