Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

# Types.h File Reference

Compatibility Layer and fundamental tools and types. More...

## Namespaces
namespace | cat
## Defines
#define | FALSE false
#define | TRUE true
#define | COM_RELEASE(ref) if (ref) { (ref)->Release(); (ref) = 0; }
#define | SINGLE_RELEASE(ref) if (ref) { delete (ref); (ref) = 0; }
#define | ARRAY_RELEASE(ref) if (ref) { delete [](ref); (ref) = 0; }
#define | BOSWAP32(n) ( ((n) << 24) | (((n) & 0x00ff0000) >> 8) | (((n) & 0x0000ff00) << 8) | ((n) >> 24) )
#define | BOSWAP16(n) ( ((n) << 8) | ((n) >> 8) )
#define | swapBE(n)
#define | getBE(n) (n)
#define | ROL8(n, r) ( ((n) << (r)) | ((n) >> ( 8 - (r))) )
#define | ROR8(n, r) ( ((n) >> (r)) | ((n) << ( 8 - (r))) )
#define | ROL16(n, r) ( ((n) << (r)) | ((n) >> (16 - (r))) )
#define | ROR16(n, r) ( ((n) >> (r)) | ((n) << (16 - (r))) )
#define | ROL32(n, r) ( ((n) << (r)) | ((n) >> (32 - (r))) )
#define | ROR32(n, r) ( ((n) >> (r)) | ((n) << (32 - (r))) )
#define | MEMADD32(ptr, len, val)
#define | STRNCPY(dest, src, size)
#define | MEMCLR(dest, size) memset(dest, 0, size)
#define | OBJCLR(object) memset(&(object), 0, sizeof(object))
#define | _C1B_INTERMED(n) ( (n) - (((n) >> 1) & 033333333333) - (((n) >> 2) & 011111111111) )
#define | COUNT1BITS32(n) ( ((_C1B_INTERMED(n) + (_C1B_INTERMED(n) >> 3)) & 030707070707) % 63 )
#define | AT_LEAST_2_BITS(n) ( (n) & ((n) - 1) )
#define | LEAST_SIGNIFICANT_BIT(n) ( (n) & -(n) )
#define | IS_POWER_OF_2(n) ( n && !AT_LEAST_2_BITS(n) )
#define | CEIL_UNIT(n, width) ( ( (n) + (width) - 1 ) / (width) )
#define | CEIL(n, width) ( CEIL_UNIT(n, width) * (width) )
#define | IS_ALPHA(ch) ( (((u8)(ch) & 0xc0) == 0x40) && ((((u8)(ch) - 1) & 0x1f) <= 0x19) )
#define | IS_NUM(ch) ( ((u8)(ch) - 0x30) < 10 )
#define | IS_ALPHANUM(ch) ( IS_ALPHA(ch) || IS_NUM(ch) )
#define | TO_LOWER(ch) (char)( (ch) | 0x20 )
#define | TO_UPPER(ch) (char)( (ch) & (~0x20) )
## Typedefs
typedef unsigned char | u8
typedef signed char | s8
typedef unsigned short | u16
typedef signed short | s16
typedef unsigned int | u32
typedef signed int | s32
typedef float | f32
typedef double | f64
typedef s32 | sfp22_10
typedef u32 | ufp22_10
typedef s32 | sfp16_16
typedef u32 | ufp16_16
## Functions
INLINE void | swapLE (u32 &n)
INLINE void | swapLE (u16 &n)
INLINE u32 | getLE (u32 n)
INLINE u16 | getLE (u16 n)
INLINE void | swapLE (s32 &n)
INLINE void | swapLE (s16 &n)
INLINE s32 | getLE (s32 n)
INLINE s16 | getLE (s16 n)
INLINE cat::u32 | next_highest_power_of_2 (cat::u32 n)

## Detailed Description

Compatibility Layer and fundamental tools and types.

     * Fundamental tools & types
     *
     * Catid(cat02e@fsu.edu)
     *
     * 8/9/2004 Added SINGLE/ARRAY_RELEASE
     * 8/5/2004 Added COMPILER_ preprocessors
     *    class NoCopies
     * 8/1/2004 Removed mask stuff
     * 7/29/2004 Added swapLE, swapBE, getLE, getBE
     * 7/28/2004 Automatic and AutoArray now compile in dev-c++
     *    Added pre-processor conditions to support
     *    other compilers
     *    Removed GETWORD and GETDWORD
     * 7/15/2004 Now using COM_RELEASE throughout CatGL3
     * 6/22/2004 Removed triple and pair
     * 6/12/2004 AutoDeallocate -> Automatic, AutoArray
     * 6/9/2004 OBJCLR
     * 5/2/2004 class AutoDeallocate
     * 5/1/2004 IS_POWER_OF_2, next_highest_power_of_2
     * 4/30/2004 Merged character manip macros
     * 2/23/2004 CEIL*
     *    Removed MEMCOPY32 and MEMCLEAR32,
     *    memcpy and memset are now faster
     *    MAKE_MASK
     * 2/10/2004 LITTLE_ENDIAN
     *    COUNT1BITS32
     *    AT_LEAST_2_BITS
     *    LEAST_SIGNIFICANT_BIT
     * X-mas/2003 [u/s]int?? -> [u/s]??
     * 7/3/2003 Added template triple, point->pair
     * 6/15/2003 Added template rect, point
     * 3/30/2003 Added RO?8, RO?16 and ?int64
     *    Added MEMCOPY32 and MEMCLEAR32
     * 3/12/2003 Added GETWORD and GETDWORD
     * 1/16/2003 Formalized this library.
     *
     * Tabs: 4 spaces
     * Dist: public
     *

## Define Documentation

#define _C1B_INTERMED | ( | n |  | ) | ( (n) - (((n) >> 1) & 033333333333) - (((n) >> 2) & 011111111111) )

#define ARRAY_RELEASE | ( | ref |  | ) | if (ref) { delete [](ref); (ref) = 0; }

#define AT_LEAST_2_BITS | ( | n |  | ) | ( (n) & ((n) - 1) )

#define BOSWAP16 | ( | n |  | ) | ( ((n) << 8) | ((n) >> 8) )

#define BOSWAP32 | ( | n |  | ) | ( ((n) << 24) | (((n) & 0x00ff0000) >> 8) | (((n) & 0x0000ff00) << 8) | ((n) >> 24) )

#define CEIL | ( | n,
|  | width |  | ) | ( CEIL_UNIT(n, width) * (width) )

#define CEIL_UNIT | ( | n,
|  | width |  | ) | ( ( (n) + (width) - 1 ) / (width) )

#define COM_RELEASE | ( | ref |  | ) | if (ref) { (ref)->Release(); (ref) = 0; }

#define COUNT1BITS32 | ( | n |  | ) | ( ((_C1B_INTERMED(n) + (_C1B_INTERMED(n) >> 3)) & 030707070707) % 63 )

#define FALSE false

| Define an alias between FALSE and false

#define getBE | ( | n |  | ) | (n)

#define IS_ALPHA | ( | ch |  | ) | ( (((u8)(ch) & 0xc0) == 0x40) && ((((u8)(ch) - 1) & 0x1f) <= 0x19) )

#define IS_ALPHANUM | ( | ch |  | ) | ( IS_ALPHA(ch) || IS_NUM(ch) )

#define IS_NUM | ( | ch |  | ) | ( ((u8)(ch) - 0x30) < 10 )

#define IS_POWER_OF_2 | ( | n |  | ) | ( n && !AT_LEAST_2_BITS(n) )

#define LEAST_SIGNIFICANT_BIT | ( | n |  | ) | ( (n) & -(n) )

#define MEMADD32 | ( | ptr,
|  | len,
|  | val |  | ) |

| Value:
    { \
                    register u32 *__data = (u32*)(ptr); /* pointer to data to clear */ \
                    register s32 __length = (len); /* number of 32-bit blocks */ \
                    \
                    switch (__length % 8) \
                    { \
                            case 0: do { *__data++ += (val); \
                                    case 7:   *__data++ += (val); \
                                    case 6:   *__data++ += (val); \
                                    case 5:   *__data++ += (val); \
                                    case 4:   *__data++ += (val); \
                                    case 3:   *__data++ += (val); \
                                    case 2:   *__data++ += (val); \
                                    case 1:   *__data++ += (val); \
                                    __length -= 8; \
                            } while(__length > 0); \
                    } \
            }

#define MEMCLR | ( | dest,
|  | size |  | ) | memset(dest, 0, size)

#define OBJCLR | ( | object |  | ) | memset(&(object), 0, sizeof(object))

#define ROL16 | ( | n,
|  | r |  | ) | ( ((n) << (r)) | ((n) >> (16 - (r))) )

#define ROL32 | ( | n,
|  | r |  | ) | ( ((n) << (r)) | ((n) >> (32 - (r))) )

#define ROL8 | ( | n,
|  | r |  | ) | ( ((n) << (r)) | ((n) >> ( 8 - (r))) )

#define ROR16 | ( | n,
|  | r |  | ) | ( ((n) >> (r)) | ((n) << (16 - (r))) )

#define ROR32 | ( | n,
|  | r |  | ) | ( ((n) >> (r)) | ((n) << (32 - (r))) )

#define ROR8 | ( | n,
|  | r |  | ) | ( ((n) >> (r)) | ((n) << ( 8 - (r))) )

#define SINGLE_RELEASE | ( | ref |  | ) | if (ref) { delete (ref); (ref) = 0; }

#define STRNCPY | ( | dest,
|  | src,
|  | size |  | ) |

| Value:
    { \
                    strncpy(dest, src, size); \
                    dest[size-1] = 0; \
            }
  Safe null-terminated string -> char buffer copy Parameters:
  | dest | the resulting string
  | src | the string to copy
  | size | the number of char to copy

#define swapBE | ( | n |  | ) |

#define TO_LOWER | ( | ch |  | ) | (char)( (ch) | 0x20 )

#define TO_UPPER | ( | ch |  | ) | (char)( (ch) & (~0x20) )

#define TRUE true

| Define an alias between TRUE and true

## Typedef Documentation

typedef float cat::f32

| Typename for 32 bits floatting point number

typedef double cat::f64

| Typename for 64 bits floatting point number

typedef signed short cat::s16

| Typename for 16 bits signed integer

typedef signed int cat::s32

| Typename for 32 bits signed integer

typedef signed char cat::s8

| Typename for 8 bits signed integer

typedef s32 cat::sfp16_16

| Fixed point types hi-Siiiiiiiiiiiiiii-lo | hi-ffffffffffffffff-lo

typedef s32 cat::sfp22_10

| Fixed-point types hi-Siiiiiiiiiiiiiiiiiiiii-lo | hi-ffffffffff-lo

typedef unsigned short cat::u16

| Typename for 16 bits unsigned integer

typedef unsigned int cat::u32

| Typename for 32 bits unsigned integer

typedef unsigned char cat::u8

| Typename for 8 bits unsigned integer

typedef u32 cat::ufp16_16

| Fixed point types hi-iiiiiiiiiiiiiiii-lo | hi-ffffffffffffffff-lo

typedef u32 cat::ufp22_10

| Fixed-point types hi-iiiiiiiiiiiiiiiiiiiiii-lo | hi-ffffffffff-lo

## Function Documentation

INLINE s16 cat::getLE | ( | s16 | n | ) |

INLINE s32 cat::getLE | ( | s32 | n | ) |

INLINE u16 cat::getLE | ( | u16 | n | ) |

INLINE u32 cat::getLE | ( | u32 | n | ) |

INLINE cat::u32 next_highest_power_of_2 | ( | cat::u32 | n | ) |

INLINE void cat::swapLE | ( | s16 & | n | ) |

INLINE void cat::swapLE | ( | s32 & | n | ) |

INLINE void cat::swapLE | ( | u16 & | n | ) |

INLINE void cat::swapLE | ( | u32 & | n | ) |