blob: 07c3c2cf9e3b8f969cea2e0fe91ba2874b57b76a [file] [log] [blame]
Martin Stjernholm4fb51112021-04-30 11:53:52 +01001/*
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,
36 kQ = 29u,
37 kR = 30u,
android-t13d2c5b22022-10-12 13:43:18 +080038 kS = 31u,
39 kT = 32u,
Martin Stjernholm4fb51112021-04-30 11:53:52 +010040 kMax = std::numeric_limits<uint32_t>::max(),
41};
42
43inline bool IsSdkVersionSetAndMoreThan(uint32_t lhs, SdkVersion rhs) {
44 return lhs != static_cast<uint32_t>(SdkVersion::kUnset) && lhs > static_cast<uint32_t>(rhs);
45}
46
47inline bool IsSdkVersionSetAndAtLeast(uint32_t lhs, SdkVersion rhs) {
48 return lhs != static_cast<uint32_t>(SdkVersion::kUnset) && lhs >= static_cast<uint32_t>(rhs);
49}
50
51inline bool IsSdkVersionSetAndAtMost(uint32_t lhs, SdkVersion rhs) {
52 return lhs != static_cast<uint32_t>(SdkVersion::kUnset) && lhs <= static_cast<uint32_t>(rhs);
53}
54
55inline bool IsSdkVersionSetAndLessThan(uint32_t lhs, SdkVersion rhs) {
56 return lhs != static_cast<uint32_t>(SdkVersion::kUnset) && lhs < static_cast<uint32_t>(rhs);
57}
58
59} // namespace art
60
61#endif // ART_LIBARTBASE_BASE_SDK_VERSION_H_