001 package com.ochafik.lang.jnaerator.runtime;
002
003 import com.sun.jna.IntegerType;
004 import com.sun.jna.Native;
005 import com.sun.jna.Platform;
006
007 /**
008 * 'size_t' C type (32 bits on 32 bits platforms, 64 bits on 64 bits platforms).
009 * Can be also used to model the 'long' C type for libraries known to be compiled with GCC or LLVM even on Windows.
010 * (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)
011 * @author ochafik
012 */
013 public class NativeSize extends IntegerType {
014 /** Size of a size_t integer, in bytes. */
015 public static final int SIZE = Native.SIZE_T_SIZE;//Platform.is64Bit() ? 8 : 4;
016
017 /** Create a zero-valued Size. */
018 public NativeSize() {
019 this(0);
020 }
021
022 /** Create a Size with the given value. */
023 public NativeSize(long value) {
024 super(SIZE, value);
025 }
026 }