David Brazdil | 2bb2fbd | 2018-11-13 18:24:26 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ART_LIBARTBASE_BASE_SDK_VERSION_H_ |
| 18 | #define ART_LIBARTBASE_BASE_SDK_VERSION_H_ |
| 19 | |
| 20 | #include <cstdint> |
| 21 | #include <limits> |
| 22 | |
| 23 | namespace art { |
| 24 | |
| 25 | enum class SdkVersion : uint32_t { |
| 26 | kMin = 0u, |
| 27 | kUnset = 0u, |
| 28 | kL = 21u, |
| 29 | kL_MR1 = 22u, |
| 30 | kM = 23u, |
| 31 | kN = 24u, |
| 32 | kN_MR1 = 25u, |
| 33 | kO = 26u, |
| 34 | kO_MR1 = 27u, |
| 35 | kP = 28u, |
David Brazdil | 527072e | 2019-04-03 15:15:40 +0100 | [diff] [blame] | 36 | kQ = 29u, |
Artur Satayev | b708fc1 | 2020-05-20 17:48:19 +0100 | [diff] [blame^] | 37 | kR = 30u, |
David Brazdil | 2bb2fbd | 2018-11-13 18:24:26 +0000 | [diff] [blame] | 38 | kMax = std::numeric_limits<uint32_t>::max(), |
| 39 | }; |
| 40 | |
| 41 | inline bool IsSdkVersionSetAndMoreThan(uint32_t lhs, SdkVersion rhs) { |
| 42 | return lhs != static_cast<uint32_t>(SdkVersion::kUnset) && lhs > static_cast<uint32_t>(rhs); |
| 43 | } |
| 44 | |
| 45 | inline bool IsSdkVersionSetAndAtLeast(uint32_t lhs, SdkVersion rhs) { |
| 46 | return lhs != static_cast<uint32_t>(SdkVersion::kUnset) && lhs >= static_cast<uint32_t>(rhs); |
| 47 | } |
| 48 | |
| 49 | inline bool IsSdkVersionSetAndAtMost(uint32_t lhs, SdkVersion rhs) { |
| 50 | return lhs != static_cast<uint32_t>(SdkVersion::kUnset) && lhs <= static_cast<uint32_t>(rhs); |
| 51 | } |
| 52 | |
| 53 | inline bool IsSdkVersionSetAndLessThan(uint32_t lhs, SdkVersion rhs) { |
| 54 | return lhs != static_cast<uint32_t>(SdkVersion::kUnset) && lhs < static_cast<uint32_t>(rhs); |
| 55 | } |
| 56 | |
| 57 | } // namespace art |
| 58 | |
| 59 | #endif // ART_LIBARTBASE_BASE_SDK_VERSION_H_ |