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, 36 kQ = 29u, 37 kMax = std::numeric_limits<uint32_t>::max(), 38 }; 39 40 inline bool IsSdkVersionSetAndMoreThan(uint32_t lhs, SdkVersion rhs) { 41 return lhs != static_cast<uint32_t>(SdkVersion::kUnset) && lhs > static_cast<uint32_t>(rhs); 42 } 43 44 inline bool IsSdkVersionSetAndAtLeast(uint32_t lhs, SdkVersion rhs) { 45 return lhs != static_cast<uint32_t>(SdkVersion::kUnset) && lhs >= static_cast<uint32_t>(rhs); 46 } 47 48 inline bool IsSdkVersionSetAndAtMost(uint32_t lhs, SdkVersion rhs) { 49 return lhs != static_cast<uint32_t>(SdkVersion::kUnset) && lhs <= static_cast<uint32_t>(rhs); 50 } 51 52 inline bool IsSdkVersionSetAndLessThan(uint32_t lhs, SdkVersion rhs) { 53 return lhs != static_cast<uint32_t>(SdkVersion::kUnset) && lhs < static_cast<uint32_t>(rhs); 54 } 55 56 } // namespace art 57 58 #endif // ART_LIBARTBASE_BASE_SDK_VERSION_H_ 59