LeechCraft
0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
cpufeatures.h
Go to the documentation of this file.
1
/**********************************************************************
2
* LeechCraft - modular cross-platform feature rich internet client.
3
* Copyright (C) 2006-2014 Georg Rudoy
4
*
5
* Distributed under the Boost Software License, Version 1.0.
6
* (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7
**********************************************************************/
8
9
#pragma once
10
11
#include <cstdint>
12
#include <utility>
13
#include "
sysconfig.h
"
14
15
class
QString;
16
17
namespace
LC::Util
18
{
19
class
UTIL_SYS_API
CpuFeatures
20
{
21
uint32_t Ecx1_ = 0;
22
uint32_t Ebx7_ = 0;
23
public
:
24
CpuFeatures
();
25
26
enum class
Feature
27
{
28
SSSE3,
29
SSE41,
30
AVX,
31
XSave,
32
AVX2,
33
34
None
35
};
36
37
bool
HasFeature (Feature)
const
;
38
39
static
QString GetFeatureName (Feature);
40
41
template
<
typename
T>
42
static
T
Choose
(std::initializer_list<std::pair<Feature, T>> funcs, T fallback)
43
{
44
const
CpuFeatures
features;
45
for
(
const
auto
& pair : funcs)
46
if
(features.
HasFeature
(pair.first))
47
return
pair.second;
48
49
return
fallback;
50
}
51
private
:
52
void
DumpDetectedFeatures ()
const
;
53
};
54
}
UTIL_SYS_API
#define UTIL_SYS_API
Definition:
sysconfig.h:16
LC::Util::CpuFeatures
Definition:
cpufeatures.h:19
LC::Util::CpuFeatures::Feature
Feature
Definition:
cpufeatures.h:26
LC::Util
Definition:
icoreproxy.h:33
sysconfig.h
Media::None
@ None
No type (item doesn't correspond to a radio station).
Definition:
iradiostationprovider.h:36
LC::Util::CpuFeatures::Choose
static T Choose(std::initializer_list< std::pair< Feature, T >> funcs, T fallback)
Definition:
cpufeatures.h:42
LC::Util::CpuFeatures::HasFeature
bool HasFeature(Feature) const
Definition:
cpufeatures.cpp:78
src
util
sys
cpufeatures.h
Generated by
1.8.17