mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-12 07:50:59 +00:00
Add CharToLower and CharToUpper into util.s (#6126)
This commit adds replacement of `::tolower` and `::toupper`. Added CharToLower and CharToUpper routines reduce the number of cast operators that required for correct usage of standard C/C++ `::tolower/toupper` routines.
This commit is contained in:
@@ -73,6 +73,14 @@ inline bool is_xdigit(char c) {
|
||||
// Case-insensitive isalnum
|
||||
inline bool is_alnum(char c) { return is_alpha(c) || is_digit(c); }
|
||||
|
||||
inline char CharToUpper(char c) {
|
||||
return static_cast<char>(::toupper(static_cast<unsigned char>(c)));
|
||||
}
|
||||
|
||||
inline char CharToLower(char c) {
|
||||
return static_cast<char>(::tolower(static_cast<unsigned char>(c)));
|
||||
}
|
||||
|
||||
// @end-locale-independent functions for ASCII character set
|
||||
|
||||
#ifdef FLATBUFFERS_PREFER_PRINTF
|
||||
|
||||
Reference in New Issue
Block a user