blob: 4a253d20bd9bc3566a624014aa165da92eb9c4fa [file] [log] [blame]
David Brazdil2bb2fbd2018-11-13 18:24:26 +00001/*
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
23namespace art {
24
25enum 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 Brazdil527072e2019-04-03 15:15:40 +010036 kQ = 29u,
Artur Satayevb708fc12020-05-20 17:48:19 +010037 kR = 30u,
David Brazdil2bb2fbd2018-11-13 18:24:26 +000038 kMax = std::numeric_limits<uint32_t>::max(),
39};
40
41inline bool IsSdkVersionSetAndMoreThan(uint32_t lhs, SdkVersion rhs) {
42 return lhs != static_cast<uint32_t>(SdkVersion::kUnset) && lhs > static_cast<uint32_t>(rhs);
43}
44
45inline bool IsSdkVersionSetAndAtLeast(uint32_t lhs, SdkVersion rhs) {
46 return lhs != static_cast<uint32_t>(SdkVersion::kUnset) && lhs >= static_cast<uint32_t>(rhs);
47}
48
49inline bool IsSdkVersionSetAndAtMost(uint32_t lhs, SdkVersion rhs) {
50 return lhs != static_cast<uint32_t>(SdkVersion::kUnset) && lhs <= static_cast<uint32_t>(rhs);
51}
52
53inline 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_