Lines Matching refs:n
89 template<int n, typename T>
91 COMPILE_ASSERT((n & (n - 1)) == 0, n_not_power_of_two); in IsAligned()
92 return (x & (n - 1)) == 0; in IsAligned()
95 template<int n, typename T>
97 return IsAligned<n>(reinterpret_cast<const uintptr_t>(x)); in IsAligned()
101 static inline bool IsAlignedParam(T x, int n) { in IsAlignedParam() argument
102 return (x & (n - 1)) == 0; in IsAlignedParam()
184 static constexpr T RoundDown(T x, typename TypeIdentity<T>::type n) WARN_UNUSED;
187 static constexpr T RoundDown(T x, typename TypeIdentity<T>::type n) {
189 DCHECK_CONSTEXPR(IsPowerOfTwo(n), , T(0))
190 (x & -n);
194 static constexpr T RoundUp(T x, typename TypeIdentity<T>::type n) WARN_UNUSED;
197 static constexpr T RoundUp(T x, typename TypeIdentity<T>::type n) {
198 return RoundDown(x + n - 1, n);
203 static inline T* AlignDown(T* x, uintptr_t n) WARN_UNUSED;
206 static inline T* AlignDown(T* x, uintptr_t n) {
207 return reinterpret_cast<T*>(RoundDown(reinterpret_cast<uintptr_t>(x), n));
211 static inline T* AlignUp(T* x, uintptr_t n) WARN_UNUSED;
214 static inline T* AlignUp(T* x, uintptr_t n) {
215 return reinterpret_cast<T*>(RoundUp(reinterpret_cast<uintptr_t>(x), n));