RawSpeed
fast raw decoding library
Loading...
Searching...
No Matches
cpu-large-page-size.cpp
Go to the documentation of this file.
1
#include <cstddef>
2
#include <iostream>
3
4
#if defined(__i386__) || defined(__x86_64__)
5
6
#include <cpuid.h>
7
8
/* Features in %edx for leaf 1 */
9
#if !defined(bit_PSE)
10
#define bit_PSE 0x00000008
11
#endif
12
#if !defined(bit_PAE)
13
#define bit_PAE 0x00000040
14
#endif
15
16
int
main
() {
17
unsigned
int
eax;
18
unsigned
int
ebx;
19
unsigned
int
ecx;
20
unsigned
int
edx;
21
22
if
(!__get_cpuid(1, &eax, &ebx, &ecx, &edx))
23
return
1;
// Detection failed.
24
25
size_t
val
;
26
if
(edx & bit_PAE)
27
val
= 2 * 1024 * 1024;
// 2 MiB
28
else
if
(edx & bit_PSE)
29
val
= 4 * 1024 * 1024;
// 4 MiB
30
else
31
val
= 4 * 1024;
// 4 KiB
32
33
std::cout <<
val
<< std::endl;
34
return
0;
35
}
36
37
#else
38
39
int
main
() {
40
// Don't know how to perform detection. Just fall back to page size.
41
std::cout << RAWSPEED_PAGESIZE << std::endl;
42
return
0;
43
}
44
45
#endif
main
int main()
Definition
cpu-large-page-size.cpp:39
rawspeed::val
va_list val
Definition
RawspeedException.h:48
cmake
Modules
cpu-large-page-size.cpp
Generated by
1.15.0