Max 5 API Reference
00001 /* common.h -- those things we define often */ 00002 #ifndef _EXT_COMMON_H_ 00003 #define _EXT_COMMON_H_ 00004 00005 00006 /** 00007 If a value is within the specified range, then return true. Otherwise return false. 00008 00009 @ingroup misc 00010 @param v The value to test. 00011 @param lo The low bound for the range. 00012 @param hi The high bound for the range. 00013 @return Returns true if within range, otherwise false. 00014 */ 00015 #define InRange(v,lo,hi) ((v)<=(hi)&&(v)>=(lo)) 00016 00017 00018 /** 00019 Return the higher of two values. 00020 00021 @ingroup misc 00022 @param a The first value to compare. 00023 @param b The second value to compare. 00024 @return Returns the higher of a or b. 00025 */ 00026 #ifndef MAX 00027 #define MAX(a,b) ((a)>(b)?(a):(b)) 00028 #endif 00029 00030 00031 /** 00032 Return the lower of two values. 00033 00034 @ingroup misc 00035 @param a The first value to compare. 00036 @param b The second value to compare. 00037 @return Returns the lower of a or b. 00038 */ 00039 #ifndef MIN 00040 #define MIN(a,b) ((a)<(b)?(a):(b)) 00041 #endif 00042 00043 00044 /** 00045 Limit values to within a specified range. 00046 00047 @ingroup misc 00048 @param a The value to constrain. 00049 @param lo The low bound for the range. 00050 @param hi The high bound for the range. 00051 @return Returns the value a constrained to the range specified by lo and hi. 00052 */ 00053 #define CLIP(a, lo, hi) ( (a)>(lo)?( (a)<(hi)?(a):(hi) ):(lo) ) 00054 00055 00056 #define OSTAsChars(x) (int)((x)>>24)&0xFF,(int)((x)>>16)&0xFF,(int)((x)>>8)&0xFF,(int)((x)&0xFF) 00057 00058 00059 #endif /* _EXT_COMMON_H_ */
Copyright © 2008, Cycling '74