summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_common.h
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_common.h')
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_common.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common.h b/compiler-rt/lib/sanitizer_common/sanitizer_common.h
index a606688f505..9b4c880a0bf 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common.h
@@ -89,6 +89,18 @@ inline uptr RoundUpTo(uptr size, uptr boundary) {
template<class T> T Min(T a, T b) { return a < b ? a : b; }
template<class T> T Max(T a, T b) { return a > b ? a : b; }
+// Char handling
+inline bool IsSpace(int c) {
+ return (c == ' ') || (c == '\n') || (c == '\t') ||
+ (c == '\f') || (c == '\r') || (c == '\v');
+}
+inline bool IsDigit(int c) {
+ return (c >= '0') && (c <= '9');
+}
+inline int ToLower(int c) {
+ return (c >= 'A' && c <= 'Z') ? (c + 'a' - 'A') : c;
+}
+
#if __WORDSIZE == 64
# define FIRST_32_SECOND_64(a, b) (b)
#else
OpenPOWER on IntegriCloud