#ifndef _UNP_H_
#define _UNP_H_

#include <string.h>

#ifndef i8
	#define i8	char
	#define i16	short
	#define i32	int
	#define i64	long long
#endif /*i8*/

#ifndef u8
	#define u8	unsigned char
	#define u16	unsigned short
	#define u32	unsigned int
	#define u64	unsigned long long
#endif /*u8*/

#ifndef min
	#define		min(x,y) (((x) < (y)) ? (x) : (y))
#endif

#ifndef max
	#define		max(x,y) (((x) > (y)) ? (x) : (y))
#endif

#ifndef NULL
	#define		NULL	((void *)0)
#endif

#ifdef KERNEL
	#define log_msg(fmt, args...) printk("%s %d: %s " fmt, __FILE__, __LINE__, __FUNCTION__, ## args)
#else
	#define log_msg(fmt, args...) fprintf(stdout, "%s %d: %s " fmt, __FILE__, __LINE__, __FUNCTION__, ## args)
#endif /*KERNEL*/

#ifdef DEBUG
	#define d_msg log_msg
#else
	#define d_msg(args...)
#endif

#ifdef KERNEL
	#define err_msg(fmt, args...)	printk("%s %d: %s %s " fmt, __FILE__, __LINE__, __FUNCTION__, \
						strerror(errno), ## args)
#else
	#define err_msg(fmt, args...)	fprintf(stderr, "%s %d: %s %s " fmt, __FILE__, __LINE__, __FUNCTION__, \
						strerror(errno), ## args)
#endif	/*KERNEL*/
						
#endif	/* not _UNP_H_*/
