blob: 20654b613384c2e2cfd22f8d7795a7ffe83e31ca [file] [log] [blame]
Adam Lesinski40e8eef2014-09-16 14:43:29 -07001/*
2 * Copyright (C) 2014 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#include "Abi.h"
18
19namespace split {
20namespace abi {
21
22static const std::vector<Variant> sNoneVariants = {};
23static const std::vector<Variant> sArmVariants =
24 {Variant::armeabi, Variant::armeabi_v7a, Variant::arm64_v8a};
25static const std::vector<Variant> sIntelVariants = {Variant::x86, Variant::x86_64};
26static const std::vector<Variant> sMipsVariants = {Variant::mips, Variant::mips64};
27
28Family getFamily(Variant variant) {
29 switch (variant) {
30 case Variant::none:
31 return Family::none;
32 case Variant::armeabi:
33 case Variant::armeabi_v7a:
34 case Variant::arm64_v8a:
35 return Family::arm;
36 case Variant::x86:
37 case Variant::x86_64:
38 return Family::intel;
39 case Variant::mips:
40 case Variant::mips64:
41 return Family::mips;
42 }
43 return Family::none;
44}
45
46const std::vector<Variant>& getVariants(Family family) {
47 switch (family) {
48 case Family::none:
49 return sNoneVariants;
50 case Family::arm:
51 return sArmVariants;
52 case Family::intel:
53 return sIntelVariants;
54 case Family::mips:
55 return sMipsVariants;
56 }
57 return sNoneVariants;
58}
59
60const char* toString(Variant variant) {
61 switch (variant) {
62 case Variant::none:
63 return "";
64 case Variant::armeabi:
65 return "armeabi";
66 case Variant::armeabi_v7a:
67 return "armeabi-v7a";
68 case Variant::arm64_v8a:
69 return "arm64-v8a";
70 case Variant::x86:
71 return "x86";
72 case Variant::x86_64:
73 return "x86_64";
74 case Variant::mips:
75 return "mips";
76 case Variant::mips64:
77 return "mips64";
78 }
79 return "";
80}
81
82} // namespace abi
83} // namespace split