diff options
Diffstat (limited to 'src/3rdparty/angle/src/common/mathutil.h')
-rw-r--r-- | src/3rdparty/angle/src/common/mathutil.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/3rdparty/angle/src/common/mathutil.h b/src/3rdparty/angle/src/common/mathutil.h index f32663fa02..52f2bc1c0e 100644 --- a/src/3rdparty/angle/src/common/mathutil.h +++ b/src/3rdparty/angle/src/common/mathutil.h @@ -505,21 +505,33 @@ inline unsigned int averageFloat10(unsigned int a, unsigned int b) namespace rx { +template <typename T> struct Range { Range() {} - Range(int lo, int hi) : start(lo), end(hi) { ASSERT(lo <= hi); } + Range(T lo, T hi) : start(lo), end(hi) { ASSERT(lo <= hi); } + + T start; + T end; - int start; - int end; + T length() const { return end - start; } }; +typedef Range<int> RangeI; +typedef Range<unsigned int> RangeUI; + template <typename T> T roundUp(const T value, const T alignment) { return value + alignment - 1 - (value - 1) % alignment; } +inline unsigned int UnsignedCeilDivide(unsigned int value, unsigned int divisor) +{ + unsigned int divided = value / divisor; + return (divided + ((value % divisor == 0) ? 0 : 1)); +} + template <class T> inline bool IsUnsignedAdditionSafe(T lhs, T rhs) { |