//
// Modifications History
//
// $LB (10/05/2004) : add float macros
//

#ifndef _MACROS_H_
#define _MACROS_H_

#define CHECK( MMPush_MBdeftab )			 if ((tmp_res = MMPush_MBdeftab)) return tmp_res
#define CHECK_ALLOC( adresse, taille, type ) adresse=MMmalloc(m,taille,type);if (adresse==NIL) return MERRMEM;

//$LB (10/05/2004)
_inline float MTOF(int mot)			{	return *(float*)&(mot);	}
_inline int   FTOM(float mot)		{	return ((*(int*)&(mot)) & 0xfffffffe);	}

#define MTOI( mot )							 ((mot)>>1)
#define MTOP( mot )							 ((mot)>>1)
#define ITOM( mot )							 ((mot)<<1)
#define PTOM( mot )							 (((mot)<<1)+1)
#define STR_SIZE( size )					 (2+((size)>>2))
#define SIZE( type )						 ((sizeof( type )+3)>>2)
#define INVERT(m, a, b)						 tmp_res=MMget(m,a);MMset(m,a,MMget(m,b));MMset(m,b,tmp_res);
#define GET_PTR_OBJ_BITMAP(p) 				 (p == NIL ? NULL : (((PtrObjBitmap)MMstart(m,((PtrObjVoid)MMstart(m,p))->Buffer>>1))->bits != NULL ? (PtrObjBitmap)MMstart(m,((PtrObjVoid)MMstart(m,p))->Buffer>>1) : NULL))
#define SEDROP(m, n)         ((m)->pp += (n))


#endif
