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()
172 static constexpr T RoundDown(T x, typename TypeIdentity<T>::type n) WARN_UNUSED;
175 static constexpr T RoundDown(T x, typename TypeIdentity<T>::type n) {
177 DCHECK_CONSTEXPR(IsPowerOfTwo(n), , T(0))
178 (x & -n);
182 static constexpr T RoundUp(T x, typename TypeIdentity<T>::type n) WARN_UNUSED;
185 static constexpr T RoundUp(T x, typename TypeIdentity<T>::type n) {
186 return RoundDown(x + n - 1, n);
191 static inline T* AlignDown(T* x, uintptr_t n) WARN_UNUSED;
194 static inline T* AlignDown(T* x, uintptr_t n) {
195 return reinterpret_cast<T*>(RoundDown(reinterpret_cast<uintptr_t>(x), n));
199 static inline T* AlignUp(T* x, uintptr_t n) WARN_UNUSED;
202 static inline T* AlignUp(T* x, uintptr_t n) {
203 return reinterpret_cast<T*>(RoundUp(reinterpret_cast<uintptr_t>(x), n));