summaryrefslogtreecommitdiffstats
path: root/src/native/common/Platform.c
blob: c385e1283507217847e14328e09e903da76ef896 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

#include <jni.h>

#include <assert.h>

#include "com_jogamp_common_os_Platform.h"

#if defined(_WIN32)
    #include <windows.h>
#else /* assume POSIX sysconf() availability */
    #include <unistd.h>
#endif

JNIEXPORT jint JNICALL 
Java_com_jogamp_common_os_Platform_getPointerSizeInBitsImpl(JNIEnv *env, jclass _unused) {
    return sizeof(void *) * 8;
}

JNIEXPORT jlong JNICALL 
Java_com_jogamp_common_os_Platform_getPageSizeImpl(JNIEnv *env, jclass _unused) {
#if defined(_WIN32)
    SYSTEM_INFO si;
    GetSystemInfo(&si);
    return (jlong) si.dwPageSize;
#else
    return (jlong) sysconf(_SC_PAGESIZE);
#endif
}