blob: 219ac86591429b162506ca4dea215bc70e843073 [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,
David Brazdil2bb2fbd2018-11-13 18:24:26 +000037 kMax = std::numeric_limits<uint32_t>::max(),
38};
39
40inline bool IsSdkVersionSetAndMoreThan(uint32_t lhs, SdkVersion rhs) {
41 return lhs != static_cast<uint32_t>(SdkVersion::kUnset) && lhs > static_cast<uint32_t>(rhs);
42}
43
44inline bool IsSdkVersionSetAndAtLeast(uint32_t lhs, SdkVersion rhs) {
45 return lhs != static_cast<uint32_t>(SdkVersion::kUnset) && lhs >= static_cast<uint32_t>(rhs);
46}
47
48inline bool IsSdkVersionSetAndAtMost(uint32_t lhs, SdkVersion rhs) {
49 return lhs != static_cast<uint32_t>(SdkVersion::kUnset) && lhs <= static_cast<uint32_t>(rhs);
50}
51
52inline 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_