#ifndef AL_COMMON_H
#define AL_COMMON_H

#include <inttypes.h>
#include <al_config.h>

#define	FALSE			0
#define	TRUE			1

#define LBYTE(x)		((x)&0xFF)
#define HBYTE(x)		(((x)>>8)&0xFF)
#define LNIBBLE(x)		(x&0x0F)
#define HNIBBLE(x)		((x>>4)&0x0F)

#define MIN(a,b)		(a<b ? a : b)
#define MAX(a,b)		(a>b ? a : b)

#define HUGE_VAL		(__builtin_huge_val())

#ifndef sbi
#define sbi(r,b)		(r|=1<<b)
#endif

#ifndef cbi
#define cbi(r,b)		(r&=~(1<<b))
#endif

#ifdef CLOCK_FREQ
#define F_CPU			CLOCK_FREQ
#endif

#endif
