xtc
Class Limits

java.lang.Object
  extended by xtc.Limits

public class Limits
extends java.lang.Object

The platform-dependent C type limits.

To recreate this class, compile limits.c in the same directory as this interface and run the resulting executable while piping standard output to Limits.java.

The rank for pointer difference, sizeof, and wide character types reflects the ordering char, short, int, long, and long long, starting at 1 and ignoring the sign. This program requires that the __PTRDIFF_TYPE__, __SIZE_TYPE__, and __WCHAR_TYPE__ preprocessor macros are defined.

Version:
$Revision: 1.44 $
Author:
Robert Grimm

Field Summary
static java.lang.String ARCH
          The processor architecture.
static java.math.BigInteger ARRAY_MAX
          The maximum size of fixed size arrays.
static int BOOL_ALIGN
          The alignment of boolean types.
static int BOOL_NAT_ALIGN
          The natural alignment of boolean types.
static int BOOL_SIZE
          The size of boolean types.
static int CHAR_BITS
          The bit width of char types.
static java.math.BigInteger CHAR_MAX
          The maximum value of signed char types.
static java.math.BigInteger CHAR_MIN
          The minimum value of signed char types.
static java.lang.String COMPILER_NAME
          The name of the C compiler.
static java.lang.String COMPILER_VERSION
          The C compiler version.
static int COMPILER_VERSION_MAJOR
          The major C compiler version.
static int COMPILER_VERSION_MINOR
          The minor C compiler version.
static int DOUBLE_ALIGN
          The alignment of double types.
static int DOUBLE_NAT_ALIGN
          The natural alignment of double types.
static int DOUBLE_SIZE
          The size of double types.
static int FLOAT_ALIGN
          The alignment of float types.
static int FLOAT_NAT_ALIGN
          The natural alignment of float types.
static int FLOAT_SIZE
          The size of float types.
static int FUNCTION_ALIGN
          The alignment of function types.
static int FUNCTION_SIZE
          The size of function types.
static int INT_ALIGN
          The alignment of int types.
static java.math.BigInteger INT_MAX
          The maximum value of signed int types.
static java.math.BigInteger INT_MIN
          The minimum value of signed int types.
static int INT_NAT_ALIGN
          The natural alignment of int types.
static int INT_SIZE
          The size of int types.
static boolean IS_BIG_ENDIAN
          The flag for whether the machine is big endian.
static boolean IS_CHAR_SIGNED
          The flag for whether char is signed.
static boolean IS_ELF
          The flag for the ELF object format.
static boolean IS_INT_SIGNED
          The flag for whether int is signed in bit-fields.
static boolean IS_STRING_CONST
          The flag for whether string literals consist of const char elements.
static boolean IS_WCHAR_SIGNED
          The flag for whether wchar_t is signed.
static int LONG_ALIGN
          The alignment of long types.
static int LONG_DOUBLE_ALIGN
          The alignment of long double types.
static int LONG_DOUBLE_NAT_ALIGN
          The natural alignment of long double types.
static int LONG_DOUBLE_SIZE
          The size of long double types.
static int LONG_LONG_ALIGN
          The alignment of long long types.
static java.math.BigInteger LONG_LONG_MAX
          The maximum value of signed long long types.
static java.math.BigInteger LONG_LONG_MIN
          The minimum value of signed long long types.
static int LONG_LONG_NAT_ALIGN
          The natural alignment of long long types.
static int LONG_LONG_SIZE
          The size of long long types.
static java.math.BigInteger LONG_MAX
          The maximum value of signed long types.
static java.math.BigInteger LONG_MIN
          The minimum value of signed long types.
static int LONG_NAT_ALIGN
          The natural alignment of long types.
static int LONG_SIZE
          The size of long types.
static java.lang.String OS
          The name and version of the operating system.
static int POINTER_ALIGN
          The alignment of pointer types.
static int POINTER_NAT_ALIGN
          The natural alignment of pointer types.
static int POINTER_SIZE
          The size of pointer types.
static int PTRDIFF_RANK
          The rank of pointer difference types.
static int PTRDIFF_SIZE
          The size of pointer difference types.
static int SHORT_ALIGN
          The alignment of short types.
static java.math.BigInteger SHORT_MAX
          The maximum value of signed short types.
static java.math.BigInteger SHORT_MIN
          The minimum value of signed short types.
static int SHORT_NAT_ALIGN
          The natural alignment of short types.
static int SHORT_SIZE
          The size of short types.
static int SIZEOF_RANK
          The rank of sizeof expressions.
static int SIZEOF_SIZE
          The size of sizeof expressions.
static java.math.BigInteger UCHAR_MAX
          The maximum value of unsigned char types.
static java.math.BigInteger UINT_MAX
          The maximum value of unsigned int types.
static java.math.BigInteger ULONG_LONG_MAX
          The maximum value of unsigned long long types.
static java.math.BigInteger ULONG_MAX
          The maximum value of unsigned long types.
static java.math.BigInteger USHORT_MAX
          The maximum value of unsigned short types.
static int VOID_ALIGN
          The alignment of void types.
static int VOID_SIZE
          The size of void types.
static int WCHAR_RANK
          The rank of wide character types.
static int WCHAR_SIZE
          The size of wide char types.
 
Method Summary
static boolean fitsChar(java.math.BigInteger value)
          Determine whether the specified value fits into a char.
static boolean fitsInt(java.math.BigInteger value)
          Determine whether the specified value fits into an int.
static boolean fitsLong(java.math.BigInteger value)
          Determine whether the specified value fits into a long.
static boolean fitsLongLong(java.math.BigInteger value)
          Determine whether the specified value fits into a long long.
static boolean fitsShort(java.math.BigInteger value)
          Determine whether the specified value fits into a short.
static boolean fitsUnsignedChar(java.math.BigInteger value)
          Determine whether the specified value fits into an unsigned char.
static boolean fitsUnsignedInt(java.math.BigInteger value)
          Determine whether the specified value fits into an unsigned int.
static boolean fitsUnsignedLong(java.math.BigInteger value)
          Determine whether the specified value fits into an unsigned long.
static boolean fitsUnsignedLongLong(java.math.BigInteger value)
          Determine whether the specified value fits into an unsigned long long.
static boolean fitsUnsignedShort(java.math.BigInteger value)
          Determine whether the specified value fits into an unsigned short.
static java.math.BigInteger maskAsInt(java.math.BigInteger value)
          Mask the specified value as a signed int.
static java.math.BigInteger maskAsLong(java.math.BigInteger value)
          Mask the specified value as a signed long.
static java.math.BigInteger maskAsLongLong(java.math.BigInteger value)
          Mask the specified value as a signed long long.
static java.math.BigInteger maskAsShort(java.math.BigInteger value)
          Mask the specified value as a signed short.
static java.math.BigInteger maskAsSignedChar(java.math.BigInteger value)
          Mask the specified value as a signed char.
static java.math.BigInteger maskAsUnsignedChar(java.math.BigInteger value)
          Mask the specified value as an unsigned char.
static java.math.BigInteger maskAsUnsignedInt(java.math.BigInteger value)
          Mask the specified value as an unsigned int.
static java.math.BigInteger maskAsUnsignedLong(java.math.BigInteger value)
          Mask the specified value as an unsigned long.
static java.math.BigInteger maskAsUnsignedLongLong(java.math.BigInteger value)
          Mask the specified value as an unsigned long long.
static java.math.BigInteger maskAsUnsignedShort(java.math.BigInteger value)
          Mask the specified value as an unsigned short.
static long toWidth(long size)
          Convert the specified size to the corresponding bit width.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OS

public static final java.lang.String OS
The name and version of the operating system.

See Also:
Constant Field Values

ARCH

public static final java.lang.String ARCH
The processor architecture.

See Also:
Constant Field Values

IS_ELF

public static final boolean IS_ELF
The flag for the ELF object format.

See Also:
Constant Field Values

COMPILER_NAME

public static final java.lang.String COMPILER_NAME
The name of the C compiler.

See Also:
Constant Field Values

COMPILER_VERSION

public static final java.lang.String COMPILER_VERSION
The C compiler version.

See Also:
Constant Field Values

COMPILER_VERSION_MAJOR

public static final int COMPILER_VERSION_MAJOR
The major C compiler version.

See Also:
Constant Field Values

COMPILER_VERSION_MINOR

public static final int COMPILER_VERSION_MINOR
The minor C compiler version.

See Also:
Constant Field Values

IS_BIG_ENDIAN

public static final boolean IS_BIG_ENDIAN
The flag for whether the machine is big endian.

See Also:
Constant Field Values

VOID_SIZE

public static final int VOID_SIZE
The size of void types.

See Also:
Constant Field Values

VOID_ALIGN

public static final int VOID_ALIGN
The alignment of void types.

See Also:
Constant Field Values

FUNCTION_SIZE

public static final int FUNCTION_SIZE
The size of function types.

See Also:
Constant Field Values

FUNCTION_ALIGN

public static final int FUNCTION_ALIGN
The alignment of function types.

See Also:
Constant Field Values

POINTER_SIZE

public static final int POINTER_SIZE
The size of pointer types.

See Also:
Constant Field Values

POINTER_ALIGN

public static final int POINTER_ALIGN
The alignment of pointer types.

See Also:
Constant Field Values

POINTER_NAT_ALIGN

public static final int POINTER_NAT_ALIGN
The natural alignment of pointer types.

See Also:
Constant Field Values

PTRDIFF_SIZE

public static final int PTRDIFF_SIZE
The size of pointer difference types.

See Also:
Constant Field Values

PTRDIFF_RANK

public static final int PTRDIFF_RANK
The rank of pointer difference types.

See Also:
Constant Field Values

SIZEOF_SIZE

public static final int SIZEOF_SIZE
The size of sizeof expressions.

See Also:
Constant Field Values

SIZEOF_RANK

public static final int SIZEOF_RANK
The rank of sizeof expressions.

See Also:
Constant Field Values

ARRAY_MAX

public static final java.math.BigInteger ARRAY_MAX
The maximum size of fixed size arrays.


BOOL_SIZE

public static final int BOOL_SIZE
The size of boolean types.

See Also:
Constant Field Values

BOOL_ALIGN

public static final int BOOL_ALIGN
The alignment of boolean types.

See Also:
Constant Field Values

BOOL_NAT_ALIGN

public static final int BOOL_NAT_ALIGN
The natural alignment of boolean types.

See Also:
Constant Field Values

IS_CHAR_SIGNED

public static final boolean IS_CHAR_SIGNED
The flag for whether char is signed.

See Also:
Constant Field Values

CHAR_BITS

public static final int CHAR_BITS
The bit width of char types.

See Also:
Constant Field Values

CHAR_MIN

public static final java.math.BigInteger CHAR_MIN
The minimum value of signed char types.


CHAR_MAX

public static final java.math.BigInteger CHAR_MAX
The maximum value of signed char types.


UCHAR_MAX

public static final java.math.BigInteger UCHAR_MAX
The maximum value of unsigned char types.


IS_WCHAR_SIGNED

public static final boolean IS_WCHAR_SIGNED
The flag for whether wchar_t is signed.

See Also:
Constant Field Values

WCHAR_SIZE

public static final int WCHAR_SIZE
The size of wide char types.

See Also:
Constant Field Values

WCHAR_RANK

public static final int WCHAR_RANK
The rank of wide character types.

See Also:
Constant Field Values

IS_STRING_CONST

public static final boolean IS_STRING_CONST
The flag for whether string literals consist of const char elements.

See Also:
Constant Field Values

SHORT_SIZE

public static final int SHORT_SIZE
The size of short types.

See Also:
Constant Field Values

SHORT_ALIGN

public static final int SHORT_ALIGN
The alignment of short types.

See Also:
Constant Field Values

SHORT_NAT_ALIGN

public static final int SHORT_NAT_ALIGN
The natural alignment of short types.

See Also:
Constant Field Values

SHORT_MIN

public static final java.math.BigInteger SHORT_MIN
The minimum value of signed short types.


SHORT_MAX

public static final java.math.BigInteger SHORT_MAX
The maximum value of signed short types.


USHORT_MAX

public static final java.math.BigInteger USHORT_MAX
The maximum value of unsigned short types.


IS_INT_SIGNED

public static final boolean IS_INT_SIGNED
The flag for whether int is signed in bit-fields.

See Also:
Constant Field Values

INT_SIZE

public static final int INT_SIZE
The size of int types.

See Also:
Constant Field Values

INT_ALIGN

public static final int INT_ALIGN
The alignment of int types.

See Also:
Constant Field Values

INT_NAT_ALIGN

public static final int INT_NAT_ALIGN
The natural alignment of int types.

See Also:
Constant Field Values

INT_MIN

public static final java.math.BigInteger INT_MIN
The minimum value of signed int types.


INT_MAX

public static final java.math.BigInteger INT_MAX
The maximum value of signed int types.


UINT_MAX

public static final java.math.BigInteger UINT_MAX
The maximum value of unsigned int types.


LONG_SIZE

public static final int LONG_SIZE
The size of long types.

See Also:
Constant Field Values

LONG_ALIGN

public static final int LONG_ALIGN
The alignment of long types.

See Also:
Constant Field Values

LONG_NAT_ALIGN

public static final int LONG_NAT_ALIGN
The natural alignment of long types.

See Also:
Constant Field Values

LONG_MIN

public static final java.math.BigInteger LONG_MIN
The minimum value of signed long types.


LONG_MAX

public static final java.math.BigInteger LONG_MAX
The maximum value of signed long types.


ULONG_MAX

public static final java.math.BigInteger ULONG_MAX
The maximum value of unsigned long types.


LONG_LONG_SIZE

public static final int LONG_LONG_SIZE
The size of long long types.

See Also:
Constant Field Values

LONG_LONG_ALIGN

public static final int LONG_LONG_ALIGN
The alignment of long long types.

See Also:
Constant Field Values

LONG_LONG_NAT_ALIGN

public static final int LONG_LONG_NAT_ALIGN
The natural alignment of long long types.

See Also:
Constant Field Values

LONG_LONG_MIN

public static final java.math.BigInteger LONG_LONG_MIN
The minimum value of signed long long types.


LONG_LONG_MAX

public static final java.math.BigInteger LONG_LONG_MAX
The maximum value of signed long long types.


ULONG_LONG_MAX

public static final java.math.BigInteger ULONG_LONG_MAX
The maximum value of unsigned long long types.


FLOAT_SIZE

public static final int FLOAT_SIZE
The size of float types.

See Also:
Constant Field Values

FLOAT_ALIGN

public static final int FLOAT_ALIGN
The alignment of float types.

See Also:
Constant Field Values

FLOAT_NAT_ALIGN

public static final int FLOAT_NAT_ALIGN
The natural alignment of float types.

See Also:
Constant Field Values

DOUBLE_SIZE

public static final int DOUBLE_SIZE
The size of double types.

See Also:
Constant Field Values

DOUBLE_ALIGN

public static final int DOUBLE_ALIGN
The alignment of double types.

See Also:
Constant Field Values

DOUBLE_NAT_ALIGN

public static final int DOUBLE_NAT_ALIGN
The natural alignment of double types.

See Also:
Constant Field Values

LONG_DOUBLE_SIZE

public static final int LONG_DOUBLE_SIZE
The size of long double types.

See Also:
Constant Field Values

LONG_DOUBLE_ALIGN

public static final int LONG_DOUBLE_ALIGN
The alignment of long double types.

See Also:
Constant Field Values

LONG_DOUBLE_NAT_ALIGN

public static final int LONG_DOUBLE_NAT_ALIGN
The natural alignment of long double types.

See Also:
Constant Field Values
Method Detail

toWidth

public static long toWidth(long size)
Convert the specified size to the corresponding bit width.

Parameters:
size - The size.
Returns:
The corresponding bit width.

fitsChar

public static boolean fitsChar(java.math.BigInteger value)
Determine whether the specified value fits into a char.

Parameters:
value - The value.
Returns:
true if the value fits into a char.

fitsUnsignedChar

public static boolean fitsUnsignedChar(java.math.BigInteger value)
Determine whether the specified value fits into an unsigned char.

Parameters:
value - The value.
Returns:
true if the value fits into an unsigned char.

fitsShort

public static boolean fitsShort(java.math.BigInteger value)
Determine whether the specified value fits into a short.

Parameters:
value - The value.
Returns:
true if the value fits into a short.

fitsUnsignedShort

public static boolean fitsUnsignedShort(java.math.BigInteger value)
Determine whether the specified value fits into an unsigned short.

Parameters:
value - The value.
Returns:
true if the value fits into an unsigned short.

fitsInt

public static boolean fitsInt(java.math.BigInteger value)
Determine whether the specified value fits into an int.

Parameters:
value - The value.
Returns:
true if the value fits into an int.

fitsUnsignedInt

public static boolean fitsUnsignedInt(java.math.BigInteger value)
Determine whether the specified value fits into an unsigned int.

Parameters:
value - The value.
Returns:
true if the value fits into an unsigned int.

fitsLong

public static boolean fitsLong(java.math.BigInteger value)
Determine whether the specified value fits into a long.

Parameters:
value - The value.
Returns:
true if the value fits into a long.

fitsUnsignedLong

public static boolean fitsUnsignedLong(java.math.BigInteger value)
Determine whether the specified value fits into an unsigned long.

Parameters:
value - The value.
Returns:
true if the value fits into an unsigned long.

fitsLongLong

public static boolean fitsLongLong(java.math.BigInteger value)
Determine whether the specified value fits into a long long.

Parameters:
value - The value.
Returns:
true if the value fits into a long long.

fitsUnsignedLongLong

public static boolean fitsUnsignedLongLong(java.math.BigInteger value)
Determine whether the specified value fits into an unsigned long long.

Parameters:
value - The value.
Returns:
true if the value fits into an unsigned long long.

maskAsSignedChar

public static java.math.BigInteger maskAsSignedChar(java.math.BigInteger value)
Mask the specified value as a signed char.

Parameters:
value - The value.
Returns:
The value as a signed char.

maskAsUnsignedChar

public static java.math.BigInteger maskAsUnsignedChar(java.math.BigInteger value)
Mask the specified value as an unsigned char.

Parameters:
value - The value.
Returns:
The value as an unsigned char.

maskAsShort

public static java.math.BigInteger maskAsShort(java.math.BigInteger value)
Mask the specified value as a signed short.

Parameters:
value - The value.
Returns:
The value as a signed short.

maskAsUnsignedShort

public static java.math.BigInteger maskAsUnsignedShort(java.math.BigInteger value)
Mask the specified value as an unsigned short.

Parameters:
value - The value.
Returns:
The value as an unsigned short.

maskAsInt

public static java.math.BigInteger maskAsInt(java.math.BigInteger value)
Mask the specified value as a signed int.

Parameters:
value - The value.
Returns:
The value as a signed int.

maskAsUnsignedInt

public static java.math.BigInteger maskAsUnsignedInt(java.math.BigInteger value)
Mask the specified value as an unsigned int.

Parameters:
value - The value.
Returns:
The value as an unsigned int.

maskAsLong

public static java.math.BigInteger maskAsLong(java.math.BigInteger value)
Mask the specified value as a signed long.

Parameters:
value - The value.
Returns:
The value as a signed long.

maskAsUnsignedLong

public static java.math.BigInteger maskAsUnsignedLong(java.math.BigInteger value)
Mask the specified value as an unsigned long.

Parameters:
value - The value.
Returns:
The value as an unsigned long.

maskAsLongLong

public static java.math.BigInteger maskAsLongLong(java.math.BigInteger value)
Mask the specified value as a signed long long.

Parameters:
value - The value.
Returns:
The value as a signed long long.

maskAsUnsignedLongLong

public static java.math.BigInteger maskAsUnsignedLongLong(java.math.BigInteger value)
Mask the specified value as an unsigned long long.

Parameters:
value - The value.
Returns:
The value as an unsigned long long.


Copyright © 2012. All Rights Reserved.