2009-05-03 20:53:31 +02:00
|
|
|
#ifndef _UTILS_H_
|
|
|
|
#define _UTILS_H_
|
|
|
|
|
2009-11-15 20:52:58 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2010-02-09 11:59:55 +01:00
|
|
|
/* Constants */
|
2009-05-03 20:53:31 +02:00
|
|
|
#define KB_SIZE 1024.0
|
|
|
|
#define MB_SIZE 1048576.0
|
|
|
|
#define GB_SIZE 1073741824.0
|
|
|
|
|
2010-02-09 11:59:55 +01:00
|
|
|
/* Macros */
|
2009-05-03 20:53:31 +02:00
|
|
|
#define round_up(x,n) (-(-(x) & -(n)))
|
|
|
|
|
2009-12-19 15:05:31 +01:00
|
|
|
#define SAFE_FREE(P) if(P){free(P);P=NULL;}
|
|
|
|
|
2010-02-09 11:59:55 +01: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
|