#ifndef __MACROS_H__ #define __MACROS_H__ /* $Id: macros.h,v 1.1 1993/12/18 14:37:14 vpopesc Exp $ */ /* $Log: macros.h,v $ * Revision 1.1 1993/12/18 14:37:14 vpopesc * Initial revision * */ #define Min(x,y) ((x)>(y)?(y):(x)) #define Max(x,y) ((x)<(y)?(y):(x)) #define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0])) #define EVEN(N) (((N)&1) == 0) #define ODD(N) (((N)&1) != 0) #define SETBITS(W,F) ((W) |= (F)) #define CLRBITS(W,F) ((W) &= ~(F)) /* Extracts the bits in mask M from W */ #define BITS(W,M) ((W) & (M)) #define XSETBIT(W,V) SETBITS((W),(1 << V)) #define XCLRBIT(W,V) CLRBITS((W),(1 << V)) #define XTSTBIT(W,V) BITS((W),(1 << (V))) #ifndef SYS_NO_RANDOM #define MY_RANDOM() ((unsigned int)random()) #else #define MY_RANDOM() ((unsigned int)rand()) #endif #endif /* Add nothing past this line... */