RawSpeed
fast raw decoding library
Loading...
Searching...
No Matches
cpu-page-size.cpp
Go to the documentation of this file.
1#include <iostream>
2
3#if defined(__unix__) || defined(__APPLE__)
4#include <unistd.h>
5#endif
6
7#if (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 1) || defined(__APPLE__)
8
9int main() {
10 long val = ::sysconf(_SC_PAGESIZE);
11 if (val == -1)
12 return 1;
13 std::cout << val << std::endl;
14 return 0;
15}
16
17#elif defined(_WIN32) || defined(_WIN64)
18
19#include <Windows.h>
20int main() {
21 SYSTEM_INFO si;
22 GetSystemInfo(&si);
23 std::cout << si.dwPageSize << std::endl;
24 return 0;
25}
26
27#else
28#error Do not know how to query (minimal) CPU page size for this system!
29#endif
int main()