2009-05-03 20:53:31 +02:00
|
|
|
#ifndef _UTILS_H_
|
|
|
|
#define _UTILS_H_
|
|
|
|
|
2009-11-15 20:52:58 +01:00
|
|
|
#ifdef __cplusplus
|
2010-09-19 01:16:05 +02:00
|
|
|
extern "C"
|
|
|
|
{
|
2009-11-15 20:52:58 +01:00
|
|
|
#endif
|
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
/* Constants */
|
|
|
|
#define KB_SIZE 1024.0
|
|
|
|
#define MB_SIZE 1048576.0
|
|
|
|
#define GB_SIZE 1073741824.0
|
2009-05-03 20:53:31 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
/* Macros */
|
2010-09-19 01:16:05 +02:00
|
|
|
#define round_up(x,n) (-(-(x) & -(n)))
|
2009-05-03 20:53:31 +02:00
|
|
|
|
2009-12-19 15:05:31 +01:00
|
|
|
#define SAFE_FREE(P) if(P){free(P);P=NULL;}
|
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
/* Prototypes */
|
|
|
|
u32 swap32(u32);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
2009-11-15 20:52:58 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-05-03 20:53:31 +02:00
|
|
|
#endif
|