mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00:00 
			
		
		
		
	Common: Add a clamp function to math_utils.h
This commit is contained in:
		
							parent
							
								
									0a1aab5b42
								
							
						
					
					
						commit
						2f571a0d9d
					
				
					 1 changed files with 7 additions and 0 deletions
				
			
		|  | @ -6,11 +6,18 @@ | ||||||
| 
 | 
 | ||||||
| #include "common/common.h" | #include "common/common.h" | ||||||
| 
 | 
 | ||||||
|  | #include <algorithm> | ||||||
| #include <vector> | #include <vector> | ||||||
| 
 | 
 | ||||||
| namespace MathUtil | namespace MathUtil | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
|  | template<typename T> | ||||||
|  | inline T Clamp(const T val, const T& min, const T& max) | ||||||
|  | { | ||||||
|  |     return std::max(min, std::min(max, val)); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| static const u64 DOUBLE_SIGN = 0x8000000000000000ULL, | static const u64 DOUBLE_SIGN = 0x8000000000000000ULL, | ||||||
|     DOUBLE_EXP  = 0x7FF0000000000000ULL, |     DOUBLE_EXP  = 0x7FF0000000000000ULL, | ||||||
|     DOUBLE_FRAC = 0x000FFFFFFFFFFFFFULL, |     DOUBLE_FRAC = 0x000FFFFFFFFFFFFFULL, | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue