Lines Matching refs:n
105 static constexpr T RoundDown(T x, typename std::decay<T>::type n) WARN_UNUSED;
108 static constexpr T RoundDown(T x, typename std::decay<T>::type n) { in RoundDown() argument
110 DCHECK_CONSTEXPR(IsPowerOfTwo(n), , T(0)) in RoundDown()
111 (x & -n); in RoundDown()
115 static constexpr T RoundUp(T x, typename std::remove_reference<T>::type n) WARN_UNUSED;
118 static constexpr T RoundUp(T x, typename std::remove_reference<T>::type n) { in RoundUp() argument
119 return RoundDown(x + n - 1, n); in RoundUp()
124 static inline T* AlignDown(T* x, uintptr_t n) WARN_UNUSED;
127 static inline T* AlignDown(T* x, uintptr_t n) { in AlignDown() argument
128 return reinterpret_cast<T*>(RoundDown(reinterpret_cast<uintptr_t>(x), n)); in AlignDown()
132 static inline T* AlignUp(T* x, uintptr_t n) WARN_UNUSED;
135 static inline T* AlignUp(T* x, uintptr_t n) { in AlignUp() argument
136 return reinterpret_cast<T*>(RoundUp(reinterpret_cast<uintptr_t>(x), n)); in AlignUp()
139 template<int n, typename T>
141 static_assert((n & (n - 1)) == 0, "n is not a power of two"); in IsAligned()
142 return (x & (n - 1)) == 0; in IsAligned()
145 template<int n, typename T>
147 return IsAligned<n>(reinterpret_cast<const uintptr_t>(x)); in IsAligned()
151 static inline bool IsAlignedParam(T x, int n) { in IsAlignedParam() argument
152 return (x & (n - 1)) == 0; in IsAlignedParam()