You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					23 lines
				
				476 B
			
		
		
			
		
	
	
					23 lines
				
				476 B
			| 
								 
											9 years ago
										 
									 | 
							
								#ifndef COMMON_UTIL_H
							 | 
						||
| 
								 | 
							
								#define COMMON_UTIL_H
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define min(a,b) \
							 | 
						||
| 
								 | 
							
								 ({ __typeof__ (a) _a = (a); \
							 | 
						||
| 
								 | 
							
								     __typeof__ (b) _b = (b); \
							 | 
						||
| 
								 | 
							
								   _a < _b ? _a : _b; })
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define max(a,b) \
							 | 
						||
| 
								 | 
							
								 ({ __typeof__ (a) _a = (a); \
							 | 
						||
| 
								 | 
							
								     __typeof__ (b) _b = (b); \
							 | 
						||
| 
								 | 
							
								   _a > _b ? _a : _b; })
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define clamp(a,b,c) \
							 | 
						||
| 
								 | 
							
								 ({ __typeof__ (a) _a = (a); \
							 | 
						||
| 
								 | 
							
								     __typeof__ (b) _b = (b); \
							 | 
						||
| 
								 | 
							
								     __typeof__ (c) _c = (c); \
							 | 
						||
| 
								 | 
							
								   _a < _b ? _b : (_a > _c ? _c : _a); })
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0]))
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif
							 |