00001 #ifndef __COMMON_H__
00002 #define __COMMON_H__
00003
00004
00005 #include <stdlib.h>
00006
00007
00008 #ifdef __cplusplus
00009 extern "C" {
00010 #endif
00011
00013
00014
00015 #ifndef TRUE
00016 #define TRUE (-1)
00017 #endif
00018
00019 #ifndef FALSE
00020 #define FALSE (0)
00021 #endif
00022
00023 #ifndef NULL
00024 #define NULL (0)
00025 #endif
00026
00027
00028
00029
00030 #define ROUNDUP_16(s) (s + ((16 - (s & 15)) & 15))
00031 #define SIZEOF_16(s) (sizeof(s) + ((16 - (sizeof(s) & 15)) & 15))
00032
00033 #define ROUNDUP_128(s) (s + ((128 - (s & 127)) & 127))
00034 #define SIZEOF_128(s) (sizeof(s) + ((128 - (sizeof(s) & 127)) & 127))
00035
00036 #define ROUNDUP(s,p2) (s + ((p2 - (s & (p2 - 1))) & (p2 - 1)))
00037 #define SIZEOF(s,p2) (sizeof(s) + ((p2 - (sizeof(s) & (p2 - 1))) & (p2 - 1)))
00038
00039
00040
00041
00042
00044
00045
00046
00047
00048
00049
00050 extern void* malloc_aligned(size_t size, char alignment);
00051 extern void* calloc_aligned(size_t size, char alignment);
00052
00053 extern void free_aligned(void* ptr);
00054
00055
00056 #ifdef __cplusplus
00057 }
00058 #endif
00059
00060 #endif //__COMMON_H__