mirror of
				https://github.com/Laupetin/OpenAssetTools.git
				synced 2025-11-03 20:17:09 +00:00 
			
		
		
		
	Add alignment utility
This commit is contained in:
		
							
								
								
									
										12
									
								
								src/Utils/Utils/Alignment.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								src/Utils/Utils/Alignment.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
namespace utils
 | 
			
		||||
{
 | 
			
		||||
    template <typename T>
 | 
			
		||||
    constexpr T Align(T value, T toNext)
 | 
			
		||||
    {
 | 
			
		||||
        if (toNext > 0)
 | 
			
		||||
            return (value + toNext - 1) / toNext * toNext;
 | 
			
		||||
        return value;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user