You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			28 lines
		
	
	
		
			414 B
		
	
	
	
		
			C++
		
	
			
		
		
	
	
			28 lines
		
	
	
		
			414 B
		
	
	
	
		
			C++
		
	
| // vim: set noet ts=4 sw=4:
 | |
| 
 | |
| /*! \file
 | |
|  *  \brief General purpose \ref Math "math functions"
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| #include "../types.h"
 | |
| 
 | |
| /*! \brief Basic math helper functions
 | |
|  */
 | |
| namespace Math {
 | |
| template <typename T>
 | |
| T abs(T a) {
 | |
|   return (a >= 0 ? a : -a);
 | |
| }
 | |
| 
 | |
| template <typename T>
 | |
| T min(T a, T b) {
 | |
|   return a > b ? b : a;
 | |
| }
 | |
| 
 | |
| template <typename T>
 | |
| T max(T a, T b) {
 | |
|   return a > b ? a : b;
 | |
| }
 | |
| }  // namespace Math
 |