diff options
Diffstat (limited to 'runtime/utils.h')
| -rw-r--r-- | runtime/utils.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/runtime/utils.h b/runtime/utils.h index 96e5bfa8ec..2011d9eba4 100644 --- a/runtime/utils.h +++ b/runtime/utils.h @@ -70,8 +70,6 @@ static inline uint32_t PointerToLowMemUInt32(const void* p) { return intp & 0xFFFFFFFFU; } -uint8_t* DecodeBase64(const char* src, size_t* dst_size); - std::string PrintableChar(uint16_t ch); // Returns an ASCII string corresponding to the given UTF-8 string. @@ -325,6 +323,18 @@ constexpr size_t ArrayCount(const T (&)[size]) { return size; } +// Return -1 if <, 0 if ==, 1 if >. +template <typename T> +inline static int32_t Compare(T lhs, T rhs) { + return (lhs < rhs) ? -1 : ((lhs == rhs) ? 0 : 1); +} + +// Return -1 if < 0, 0 if == 0, 1 if > 0. +template <typename T> +inline static int32_t Signum(T opnd) { + return (opnd < 0) ? -1 : ((opnd == 0) ? 0 : 1); +} + } // namespace art #endif // ART_RUNTIME_UTILS_H_ |