1 // Copyright 2017 Google Inc.
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
17 #include "hwcaps_for_testing.h"
18 #include "internal/string_view.h"
20 namespace cpu_features {
23 static auto* const g_hardware_capabilities = new HardwareCapabilities();
24 static auto* const g_platform_types = new PlatformType();
27 void SetHardwareCapabilities(uint32_t hwcaps, uint32_t hwcaps2) {
28 g_hardware_capabilities->hwcaps = hwcaps;
29 g_hardware_capabilities->hwcaps2 = hwcaps2;
32 HardwareCapabilities CpuFeatures_GetHardwareCapabilities(void) {
33 return *g_hardware_capabilities;
36 void SetPlatformTypes(const char* platform, const char* base_platform) {
37 CpuFeatures_StringView_CopyString(str(platform), g_platform_types->platform,
38 sizeof(g_platform_types->platform));
39 CpuFeatures_StringView_CopyString(str(base_platform),
40 g_platform_types->base_platform,
41 sizeof(g_platform_types->base_platform));
44 PlatformType CpuFeatures_GetPlatformType(void) { return *g_platform_types; }
45 } // namespace cpu_features