Files
2017-10-26 19:57:24 +02:00

150 lines
3.1 KiB
C
Executable File

#ifndef MOC_DATATYPE_H_
#define MOC_DATATYPE_H_
#include <stdint.h>
/**
* \addtogroup p2p_datatype
*
* Datatypes supported by MOC.
*
* There are the normal datatypes defined by C (char, short, int, ...) and special
* vector-datatypes used by the Cell Broadband Engine. For more information see
* "C/C++ Language Extensions for Cell Broadband Engine Architecture - Version 2.5"
* chapter 1.1.
**/
//@{
/**
* @name PPU & SPU
**/
//@{
/**
* Typedef defining MOC_Datatype.
*
* One byte is used to encode the Data-Type. The first four msb hold the
* size in byte / 2 ( if ((datatype & 0xF0)>>4) == 0 then size = 1 else
* size = ((datatype & 0xF0)>>4)*2 ) and the four lsb hold an id. The
* combination of id and size is used to uniquely identify
* a datatype (or rather a group of datatypes belonging together).
**/
typedef uint8_t MOC_Datatype;
/**
* MOC_Byte is a special datatype. It can match any datatype.
* It has a size of 1 byte.
**/
#define MOC_BYTE ((MOC_Datatype)0+0)
/**
* C-Datatype char.
* It has a size of 1 byte.
**/
#define MOC_CHAR ((MOC_Datatype)0+1)
/**
* C-Datatype unsigned char.
* It has a size of 1 byte.
**/
#define MOC_UNSIGNED_CHAR ((MOC_Datatype)0+2)
/**
* C-Datatype short.
* It has a size of 2 byte.
**/
#define MOC_SHORT ((MOC_Datatype)16+0)
/**
* C-Datatype unsigned short.
* It has a size of 2 byte.
**/
#define MOC_UNSIGNED_SHORT ((MOC_Datatype)16+1)
/**
* C-Datatype int.
* It has a size of 4 byte.
**/
#define MOC_INT ((MOC_Datatype)32+0)
/**
* C-Datatype unsigned int.
* It has a size of 4 byte.
**/
#define MOC_UNSIGNED ((MOC_Datatype)32+1)
/**
* C-Datatype long long.
* It has a size of 8 byte.
**/
#define MOC_LONG_LONG ((MOC_Datatype)64+0)
/**
* C-Datatype unsigned long long.
* It has a size of 8 byte.
**/
#define MOC_UNSIGNED_LONG_LONG ((MOC_Datatype)64+1)
/**
* C-Datatype float.
* It has a size of 4 byte.
**/
#define MOC_FLOAT ((MOC_Datatype)32+2)
/**
* C-Datatype double.
* It has a size of 8 byte.
**/
#define MOC_DOUBLE ((MOC_Datatype)64+5)
/**
* Cell-specific Datatype vector unsigned char (vec_uchar16).
* It has a size of 16 byte.
**/
#define MOC_VEC_UCHAR16 ((MOC_Datatype)128+0)
/**
* Cell-specific Datatype vector unsigned short (vec_ushort8).
* It has a size of 16 byte.
**/
#define MOC_VEC_USHORT8 ((MOC_Datatype)128+1)
/**
* Cell-specific Datatype vector unsigned int (vec_uint4).
* It has a size of 16 byte.
**/
#define MOC_VEC_UINT4 ((MOC_Datatype)128+2)
/**
* Cell-specific Datatype vector signed char (vec_char16).
* It has a size of 16 byte.
**/
#define MOC_VEC_CHAR16 ((MOC_Datatype)128+4)
/**
* Cell-specific Datatype vector signed short (vec_short8).
* It has a size of 16 byte.
**/
#define MOC_VEC_SHORT8 ((MOC_Datatype)128+3)
/**
* Cell-specific Datatype vector signed int (vec_int4).
* It has a size of 16 byte.
**/
#define MOC_VEC_INT4 ((MOC_Datatype)128+5)
/**
* Cell-specific Datatype vector float (vec_float4).
* It has a size of 16 byte.
**/
#define MOC_VEC_FLOAT4 ((MOC_Datatype)128+6)
//@}
//@}
#endif /*MOC_DATATYPE_H_*/