next up previous contents index
Next: Aggregate datatypes Up: Header LALDatatypes.h Previous: Complex datatypes   Contents   Index


Atomic datatypes codes

[Constant]LAL_1_BYTE_TYPE_SIZE [Constant]LAL_2_BYTE_TYPE_SIZE [Constant]LAL_4_BYTE_TYPE_SIZE [Constant]LAL_8_BYTE_TYPE_SIZE [Constant]LAL_16_BYTE_TYPE_SIZE [Constant]LAL_TYPE_SIZE_MASK [Constant]LAL_FLTPT_TYPE_FLAG [Constant]LAL_CMPLX_TYPE_FLAG [Constant]LAL_UNSGN_TYPE_FLAG [Constant]LAL_CHAR_TYPE_CODE [Constant]LAL_I2_TYPE_CODE [Constant]LAL_I4_TYPE_CODE [Constant]LAL_I8_TYPE_CODE [Constant]LAL_UCHAR_TYPE_CODE [Constant]LAL_U2_TYPE_CODE [Constant]LAL_U4_TYPE_CODE [Constant]LAL_U8_TYPE_CODE [Constant]LAL_S_TYPE_CODE [Constant]LAL_D_TYPE_CODE [Constant]LAL_C_TYPE_CODE [Constant]LAL_Z_TYPE_CODE [Type]LALTYPECODE

The following constants specify the size, in bytes, of the atomic datatype.

Name Octal Value Description
LAL_1_BYTE_TYPE_SIZE 000 1 byte type
LAL_2_BYTE_TYPE_SIZE 001 2 byte type
LAL_4_BYTE_TYPE_SIZE 002 4 byte type
LAL_8_BYTE_TYPE_SIZE 003 8 byte type
LAL_16_BYTE_TYPE_SIZE 004 16 byte type
LAL_TYPE_SIZE_MASK 007 Mask for byte type size fields

The constant LAL_TYPE_SIZE_MASK is useful in extracting the size information from other type attributes. For example, the size, in bytes, of an atomic datatype can be found using something like the following:

   UINT4 code = LAL_S_TYPE_CODE;
   UINT4 size = 1U << ( code & LAL_TYPE_SIZE_MASK );





The following constants are flags describing the type attributes. A type is either an integer or a floating-point, either purely real or complex, and, if integer, is either signed or unsigned.

Name Octal Value Description
LAL_FLTPT_TYPE_FLAG 010 Floating-point (not integer) type
LAL_CMPLX_TYPE_FLAG 020 Complex (not purely real) type
LAL_UNSGN_TYPE_FLAG 040 Unsigned (no sign info) type

To get the actual type, these flags are combined together and with the type size constants using the bitwise-or operator (|). For example, an eight-byte floating point number would be LAL_8_BYTE_TYPE_SIZE | LAL_FLTPT_TYPE_FLAG. Conceivably you could have a complex type made from a pair of unsigned one-byte integers that would be specified as LAL_1_BYTE_TYPE_SIZE | LAL_CMPLX_TYPE_FLAG | LAL_UNSGN_TYPE_FLAG. Fortunately, there are none of these in LAL. Attribues of a particular type can be extracted using the bitwise-and operator. For example:

   UINT4 code = LAL_S_TYPE_CODE;
   UINT4 isfloat = ( code & LAL_FLTPT_TYPE_FLAG );
   UINT4 iscmplx = ( code & LAL_CMPLX_TYPE_FLAG );





The following constants correspond to the types that actually exist in LAL. Their enumeration is the type LALTYPECODE.

Name Octal Value Corresponding Type
LAL_CHAR_TYPE_CODE 000 CHAR
LAL_I2_TYPE_CODE 001 INT2
LAL_I4_TYPE_CODE 002 INT4
LAL_I8_TYPE_CODE 003 INT8
LAL_UCHAR_TYPE_CODE 040 UCHAR
LAL_U2_TYPE_CODE 041 UINT2
LAL_U4_TYPE_CODE 042 UINT4
LAL_U8_TYPE_CODE 043 UINT8
LAL_S_TYPE_CODE 012 REAL4
LAL_D_TYPE_CODE 013 REAL8
LAL_C_TYPE_CODE 033 COMPLEX8
LAL_Z_TYPE_CODE 034 COMPLEX16


next up previous contents index
Next: Aggregate datatypes Up: Header LALDatatypes.h Previous: Complex datatypes   Contents   Index
LAL test account 2003-10-23