OSDN Git Service

Moved the CPU detection code into the MUtils library.
[mutilities/MUtilities.git] / include / MUtils / CPUFeatures.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // MuldeR's Utilities for Qt
3 // Copyright (C) 2004-2014 LoRd_MuldeR <MuldeR2@GMX.de>
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
18 //
19 // http://www.gnu.org/licenses/lgpl-2.1.txt
20 //////////////////////////////////////////////////////////////////////////////////
21
22 #pragma once
23
24 //MUtils
25 #include <MUtils/Global.h>
26
27 //Qt
28 #include <QStringList>
29
30 namespace MUtils
31 {
32         namespace CPUFetaures
33         {
34                 //CPU flags
35                 static const quint32 FLAG_MMX   = 0x01;
36                 static const quint32 FLAG_SSE   = 0x02;
37                 static const quint32 FLAG_SSE2  = 0x04;
38                 static const quint32 FLAG_SSE3  = 0x08;
39                 static const quint32 FLAG_SSSE3 = 0x10;
40                 static const quint32 FLAG_SSE4  = 0x20;
41                 static const quint32 FLAG_SSE42 = 0x40;
42
43                 //CPU features
44                 typedef struct _cpu_info_t
45                 {
46                         quint32 family;
47                         quint32 model;
48                         quint32 stepping;
49                         quint32 count;
50                         quint32 features;
51                         bool x64;
52                         bool intel;
53                         char vendor[0x40];
54                         char brand[0x40];
55                 }
56                 cpu_info_t;
57
58                 MUTILS_API cpu_info_t detect(const QStringList &argv);
59         }
60 }