1 package com.ochafik.lang.jnaerator.runtime;
2
3 import com.sun.jna.IntegerType;
4 import com.sun.jna.Native;
5 import com.sun.jna.Platform;
6
7 /**
8 * 'size_t' C type (32 bits on 32 bits platforms, 64 bits on 64 bits platforms).
9 * Can be also used to model the 'long' C type for libraries known to be compiled with GCC or LLVM even on Windows.
10 * (NativeLong on Windows is only okay with MSVC++ libraries, as 'long' on Windows 64 bits will be 32 bits with MSVC++ and 64 bits with GCC/mingw)
11 * @author ochafik
12 */
13 public class NativeSize extends IntegerType {
14 /** Size of a size_t integer, in bytes. */
15 public static final int SIZE = Native.SIZE_T_SIZE;//Platform.is64Bit() ? 8 : 4;
16
17 /** Create a zero-valued Size. */
18 public NativeSize() {
19 this(0);
20 }
21
22 /** Create a Size with the given value. */
23 public NativeSize(long value) {
24 super(SIZE, value);
25 }
26 }